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

Last change on this file was f25d07e, checked in by Marko <Marko@…>, 2 years ago

Edited registration and login services

  • 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 = "ConfirmationToken")
16@Table(name = "confirmation_tokens")
17public class ConfirmationToken {
18
19 @SequenceGenerator(
20 name = "confirmation_token_sequence",
21 sequenceName = "confirmation_token_sequence",
22 allocationSize = 1
23 )
24 @Id
25 @GeneratedValue(
26 strategy = GenerationType.SEQUENCE,
27 generator = "confirmation_token_sequence"
28 )
29 private Long id;
30 @Column(nullable = false)
31 private String token;
32 @Column(nullable = false)
33 private LocalDateTime createdAt;
34 @Column(nullable = false)
35 private LocalDateTime expiresAt;
36
37 private LocalDateTime confirmedAt;
38 @ManyToOne(cascade = CascadeType.ALL)
39 @JoinColumn(
40 nullable = false,
41 name = "user_id"
42 )
43 private User user;
44
45 public ConfirmationToken(String token,
46 LocalDateTime createdAt,
47 LocalDateTime expiresAt,
48 User user) {
49 this.token = token;
50 this.createdAt = createdAt;
51 this.expiresAt = expiresAt;
52 this.user = user;
53 }
54}
Note: See TracBrowser for help on using the repository browser.