source: src/main/java/com/tourMate/entities/Token.java@ 07f4e8b

Last change on this file since 07f4e8b was e6c2521, checked in by darsov2 <62809499+darsov2@…>, 6 months ago

images upload/download impl, other fixes

  • Property mode set to 100644
File size: 2.1 KB
Line 
1package com.tourMate.entities;
2
3import jakarta.persistence.*;
4
5import java.time.LocalDateTime;
6
7@Entity
8public class Token {
9 private Long id;
10 private String token;
11 private LocalDateTime createdAt;
12 private LocalDateTime expiresAt;
13
14 private LocalDateTime confirmedAt;
15 @ManyToOne(cascade = CascadeType.ALL)
16 @JoinColumn(name = "user_id", foreignKey = @ForeignKey(name = "fk_ref_od_token_kon_user"))
17 private User user;
18
19 public Token(String token, LocalDateTime createdAt, LocalDateTime expiresAt, User user) {
20 this.token = token;
21 this.createdAt = createdAt;
22 this.expiresAt = expiresAt;
23 this.user = user;
24 }
25
26 public Token() {
27
28 }
29
30 @SequenceGenerator(name = "confirmation_token_sequence",
31 sequenceName = "confirmation_token_sequence",
32 allocationSize = 1
33 )
34 @Id
35 @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "confirmation_token_sequence")
36 public Long getId() {
37 return id;
38 }
39
40 public void setId(Long id) {
41 this.id = id;
42 }
43
44 @Column(name = "token", nullable = false)
45 public String getToken() {
46 return token;
47 }
48
49 public void setToken(String token) {
50 this.token = token;
51 }
52
53 @Column(name = "created_at", nullable = false)
54 public LocalDateTime getCreatedAt() {
55 return createdAt;
56 }
57
58 public void setCreatedAt(LocalDateTime createdAt) {
59 this.createdAt = createdAt;
60 }
61
62 @Column(name = "expires_at", nullable = false)
63 public LocalDateTime getExpiresAt() {
64 return expiresAt;
65 }
66
67 public void setExpiresAt(LocalDateTime expiresAt) {
68 this.expiresAt = expiresAt;
69 }
70
71 @Column(name = "confirmed_at", nullable = false)
72 public LocalDateTime getConfirmedAt() {
73 return confirmedAt;
74 }
75
76 public void setConfirmedAt(LocalDateTime confirmedAt) {
77 this.confirmedAt = confirmedAt;
78 }
79
80 @ManyToOne()
81 @JoinColumn(name = "user_id")
82 public User getUser() {
83 return user;
84 }
85
86 public void setUser(User user) {
87 this.user = user;
88 }
89}
Note: See TracBrowser for help on using the repository browser.