source: phonelux-backend/src/main/java/finki/it/phoneluxbackend/entities/ConfirmationToken.java@ dbd4834

Last change on this file since dbd4834 was dfd5d87, checked in by Marko <Marko@…>, 23 months ago

Registration logic with confirmation token implemented

  • Property mode set to 100644
File size: 1.4 KB
Line 
1package finki.it.phoneluxbackend.entities;
2
3import finki.it.phoneluxbackend.entities.User;
4import lombok.AllArgsConstructor;
5import lombok.Getter;
6import lombok.NoArgsConstructor;
7import lombok.Setter;
8
9import javax.persistence.*;
10import java.time.LocalDateTime;
11
12@Getter
13@Setter
14@NoArgsConstructor
15@Entity(name = "confirmation_tokens")
16public class ConfirmationToken {
17
18 @SequenceGenerator(
19 name = "confirmation_token_sequence",
20 sequenceName = "confirmation_token_sequence",
21 allocationSize = 1
22 )
23 @Id
24 @GeneratedValue(
25 strategy = GenerationType.SEQUENCE,
26 generator = "confirmation_token_sequence"
27 )
28 private Long id;
29 @Column(nullable = false)
30 private String token;
31 @Column(nullable = false)
32 private LocalDateTime createdAt;
33 @Column(nullable = false)
34 private LocalDateTime expiresAt;
35
36 private LocalDateTime confirmedAt;
37 @ManyToOne(cascade = CascadeType.ALL)
38 @JoinColumn(
39 nullable = false,
40 name = "user_id"
41 )
42 private User user;
43
44 public ConfirmationToken(String token,
45 LocalDateTime createdAt,
46 LocalDateTime expiresAt,
47 User user) {
48 this.token = token;
49 this.createdAt = createdAt;
50 this.expiresAt = expiresAt;
51 this.user = user;
52 }
53}
Note: See TracBrowser for help on using the repository browser.