[ce6ad22] | 1 | package parkup.configs.token;
|
---|
| 2 |
|
---|
[9dd526f] | 3 | import parkup.entities.RegisteredUser;
|
---|
[ce6ad22] | 4 |
|
---|
| 5 | import javax.persistence.*;
|
---|
| 6 | import java.time.LocalDateTime;
|
---|
| 7 |
|
---|
| 8 | @Entity
|
---|
[97fbc67] | 9 | public class ConfirmationTokenRP {
|
---|
[ce6ad22] | 10 |
|
---|
| 11 | @Id
|
---|
| 12 | @Column(name = "confirmation_token_id")
|
---|
| 13 | @SequenceGenerator(
|
---|
[97fbc67] | 14 | name="confirmation_token_sequence_generator_RP",
|
---|
| 15 | sequenceName = "confirmation_token_sequence_RP",
|
---|
[ce6ad22] | 16 | allocationSize = 1,
|
---|
[97fbc67] | 17 | initialValue = 1100
|
---|
[ce6ad22] | 18 | )
|
---|
| 19 | @GeneratedValue( //za postgres treba sequence da se namesti i ime na generator mi ga davamo kako od gore sto e
|
---|
| 20 | strategy = GenerationType.SEQUENCE,
|
---|
[97fbc67] | 21 | generator = "confirmation_token_sequence_generator_RP"
|
---|
[ce6ad22] | 22 | )
|
---|
| 23 | private int id;
|
---|
| 24 |
|
---|
| 25 | @Column(nullable = false)
|
---|
| 26 | private String token;
|
---|
| 27 |
|
---|
| 28 | @Column(nullable = false)
|
---|
| 29 | private LocalDateTime createdAt;
|
---|
| 30 |
|
---|
| 31 | @Column(nullable = false)
|
---|
| 32 | private LocalDateTime expiresAt;
|
---|
| 33 |
|
---|
| 34 | private LocalDateTime confirmedAt;
|
---|
| 35 |
|
---|
| 36 | @ManyToOne
|
---|
[97fbc67] | 37 | @JoinColumn(nullable = false, name = "registriranParkirac_id")
|
---|
| 38 | //many confirmation tokens to one registriranParkirac
|
---|
[9dd526f] | 39 | private RegisteredUser registeredUser;
|
---|
[ce6ad22] | 40 |
|
---|
[97fbc67] | 41 | public ConfirmationTokenRP() {}
|
---|
[ce6ad22] | 42 |
|
---|
[9dd526f] | 43 | public ConfirmationTokenRP(int id, String token, LocalDateTime createdAt, LocalDateTime expiresAt, RegisteredUser registeredUser) {
|
---|
[ce6ad22] | 44 | this.id = id;
|
---|
| 45 | this.token = token;
|
---|
| 46 | this.createdAt = createdAt;
|
---|
| 47 | this.expiresAt = expiresAt;
|
---|
[9dd526f] | 48 | this.registeredUser = registeredUser;
|
---|
[ce6ad22] | 49 | }
|
---|
| 50 |
|
---|
[9dd526f] | 51 | public ConfirmationTokenRP(String token, LocalDateTime createdAt, LocalDateTime expiresAt, RegisteredUser registeredUser) {
|
---|
[ce6ad22] | 52 | this.token = token;
|
---|
| 53 | this.createdAt = createdAt;
|
---|
| 54 | this.expiresAt = expiresAt;
|
---|
[9dd526f] | 55 | this.registeredUser = registeredUser;
|
---|
[ce6ad22] | 56 | }
|
---|
| 57 |
|
---|
| 58 | public int getId() {
|
---|
| 59 | return id;
|
---|
| 60 | }
|
---|
| 61 |
|
---|
| 62 | public void setId(int id) {
|
---|
| 63 | this.id = id;
|
---|
| 64 | }
|
---|
| 65 |
|
---|
| 66 | public String getToken() {
|
---|
| 67 | return token;
|
---|
| 68 | }
|
---|
| 69 |
|
---|
| 70 | public void setToken(String token) {
|
---|
| 71 | this.token = token;
|
---|
| 72 | }
|
---|
| 73 |
|
---|
| 74 | public LocalDateTime getCreatedAt() {
|
---|
| 75 | return createdAt;
|
---|
| 76 | }
|
---|
| 77 |
|
---|
| 78 | public void setCreatedAt(LocalDateTime createdAt) {
|
---|
| 79 | this.createdAt = createdAt;
|
---|
| 80 | }
|
---|
| 81 |
|
---|
| 82 | public LocalDateTime getExpiresAt() {
|
---|
| 83 | return expiresAt;
|
---|
| 84 | }
|
---|
| 85 |
|
---|
| 86 | public void setExpiresAt(LocalDateTime expiresAt) {
|
---|
| 87 | this.expiresAt = expiresAt;
|
---|
| 88 | }
|
---|
| 89 |
|
---|
| 90 | public LocalDateTime getConfirmedAt() {
|
---|
| 91 | return confirmedAt;
|
---|
| 92 | }
|
---|
| 93 |
|
---|
| 94 | public void setConfirmedAt(LocalDateTime confirmedAt) {
|
---|
| 95 | this.confirmedAt = confirmedAt;
|
---|
| 96 | }
|
---|
| 97 |
|
---|
[9dd526f] | 98 | public RegisteredUser getRegistriranParkirac() {
|
---|
| 99 | return registeredUser;
|
---|
[ce6ad22] | 100 | }
|
---|
| 101 |
|
---|
[9dd526f] | 102 | public void setRegistriranParkirac(RegisteredUser registeredUser) {
|
---|
| 103 | this.registeredUser = registeredUser;
|
---|
[ce6ad22] | 104 | }
|
---|
| 105 | }
|
---|