NCP-3 add exception,add change password logic, fix checkauthtoken
This commit is contained in:
@@ -7,6 +7,7 @@ import lombok.*;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -23,31 +24,36 @@ public class User {
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private Long userId;
|
||||
private Long Id;
|
||||
|
||||
@Size(max = 64)
|
||||
@Column(name = "first_name", nullable = false, length = 64)
|
||||
private String firstName;
|
||||
|
||||
@Size(max = 64)
|
||||
@Column(name = "last_name", nullable = false, length = 64)
|
||||
private String lastName;
|
||||
|
||||
@Size(max = 64)
|
||||
@Column(name = "second_name", length = 64)
|
||||
private String secondName;
|
||||
@Column(name = "full_name", nullable = false)
|
||||
private String fullName;
|
||||
|
||||
@Size(max = 1024)
|
||||
@Column(name = "email", nullable = false, length = 1024, unique = true)
|
||||
private String email;
|
||||
|
||||
@Column(name = "company")
|
||||
private String company;
|
||||
|
||||
@Column(nullable = false)
|
||||
@Size(min = 6)
|
||||
@JsonIgnore
|
||||
private String password;
|
||||
|
||||
@Size(min = 11, max = 14)
|
||||
private String phone;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "subscription_type", nullable = false, length = 20)
|
||||
private SubscriptionType subscriptionType = SubscriptionType.START;
|
||||
private SubscriptionType subscriptionType = SubscriptionType.DEMO;
|
||||
|
||||
@Enumerated(EnumType.STRING)
|
||||
@Column(name = "gender")
|
||||
private GenderType genderType = GenderType.MALE;
|
||||
|
||||
@Column(name = "birthday")
|
||||
private LocalDate birthday;
|
||||
|
||||
@CreatedDate
|
||||
@Column(name = "created_at", updatable = false, nullable = false)
|
||||
@@ -83,11 +89,4 @@ public class User {
|
||||
@JsonIgnore
|
||||
@ToString.Exclude
|
||||
private List<ImageProtection> imageProtections = new ArrayList<>();
|
||||
|
||||
public String getFullName() {
|
||||
if (secondName != null && !secondName.isBlank()) {
|
||||
return String.format("%s %s %s", lastName, firstName, secondName);
|
||||
}
|
||||
return String.format("%s %s", lastName, firstName);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user