1 | package com.example.moviezone.model;
|
---|
2 |
|
---|
3 | import jakarta.persistence.*;
|
---|
4 | import lombok.Getter;
|
---|
5 | import lombok.Setter;
|
---|
6 | import lombok.ToString;
|
---|
7 | import org.springframework.security.core.GrantedAuthority;
|
---|
8 | import org.springframework.security.core.userdetails.UserDetails;
|
---|
9 |
|
---|
10 | import javax.management.relation.Role;
|
---|
11 | import java.time.LocalDate;
|
---|
12 | import java.time.LocalDateTime;
|
---|
13 | import java.util.Collection;
|
---|
14 |
|
---|
15 | @Entity
|
---|
16 | @Getter
|
---|
17 | @Setter
|
---|
18 | @ToString
|
---|
19 | @Table(name = "users")
|
---|
20 | @Inheritance(strategy = InheritanceType.JOINED)
|
---|
21 | public class User implements UserDetails {
|
---|
22 |
|
---|
23 | @Id
|
---|
24 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
---|
25 | Integer id_user;
|
---|
26 | String password;
|
---|
27 | String first_name;
|
---|
28 | String last_name;
|
---|
29 | String address;
|
---|
30 | String contact_number;
|
---|
31 | String username;
|
---|
32 | LocalDate date_created;
|
---|
33 |
|
---|
34 |
|
---|
35 | public User(Integer id_user, String password, String first_name, String last_name, String address, String contact_number, String username, LocalDate date_created) {
|
---|
36 | this.id_user = id_user;
|
---|
37 | this.password = password;
|
---|
38 | this.first_name = first_name;
|
---|
39 | this.last_name = last_name;
|
---|
40 | this.address = address;
|
---|
41 | this.contact_number = contact_number;
|
---|
42 | this.username = username;
|
---|
43 | this.date_created = date_created;
|
---|
44 | }
|
---|
45 |
|
---|
46 | public User() {
|
---|
47 |
|
---|
48 | }
|
---|
49 |
|
---|
50 | @Override
|
---|
51 | public Collection<? extends GrantedAuthority> getAuthorities() {
|
---|
52 | return null;
|
---|
53 | }
|
---|
54 |
|
---|
55 |
|
---|
56 | @Override
|
---|
57 | public boolean isAccountNonExpired() {
|
---|
58 | return true;
|
---|
59 | }
|
---|
60 |
|
---|
61 | @Override
|
---|
62 | public boolean isAccountNonLocked() {
|
---|
63 | return true;
|
---|
64 | }
|
---|
65 |
|
---|
66 | @Override
|
---|
67 | public boolean isCredentialsNonExpired() {
|
---|
68 | return true;
|
---|
69 | }
|
---|
70 |
|
---|
71 | @Override
|
---|
72 | public boolean isEnabled() {
|
---|
73 | return true;
|
---|
74 | }
|
---|
75 |
|
---|
76 | }
|
---|