package finki.it.phoneluxbackend.entities; import finki.it.phoneluxbackend.entities.User; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import javax.persistence.*; import java.time.LocalDateTime; @Getter @Setter @NoArgsConstructor @Entity(name = "ConfirmationToken") @Table(name = "confirmation_tokens") public class ConfirmationToken { @SequenceGenerator( name = "confirmation_token_sequence", sequenceName = "confirmation_token_sequence", allocationSize = 1 ) @Id @GeneratedValue( strategy = GenerationType.SEQUENCE, generator = "confirmation_token_sequence" ) private Long id; @Column(nullable = false) private String token; @Column(nullable = false) private LocalDateTime createdAt; @Column(nullable = false) private LocalDateTime expiresAt; private LocalDateTime confirmedAt; @ManyToOne(cascade = CascadeType.ALL) @JoinColumn( nullable = false, name = "user_id" ) private User user; public ConfirmationToken(String token, LocalDateTime createdAt, LocalDateTime expiresAt, User user) { this.token = token; this.createdAt = createdAt; this.expiresAt = expiresAt; this.user = user; } }