NCP-3 add exception,add change password logic, fix checkauthtoken
This commit is contained in:
@@ -30,7 +30,7 @@ public class AuthToken {
|
||||
private String token;
|
||||
|
||||
@Column(name = "expires_at", nullable = false)
|
||||
private LocalDateTime expiresAt;
|
||||
private LocalDateTime expiresAt = LocalDateTime.now().plusDays(30);
|
||||
|
||||
@CreatedDate
|
||||
@Column(name = "created_at", updatable = false, nullable = false)
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
package ru.soune.no_copy.entity;
|
||||
|
||||
public enum GenderType {
|
||||
MALE, FEMALE
|
||||
}
|
||||
@@ -4,18 +4,5 @@ import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum SubscriptionType {
|
||||
START("СТАРТ"),
|
||||
BASIC("БАЗОВЫЙ"),
|
||||
PRO("ПРО"),
|
||||
ENTERPRISE("ЭНТЕРПРАЙЗ");
|
||||
|
||||
private final String displayName;
|
||||
|
||||
SubscriptionType(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
START, BASIC, PRO, ENTERPRISE, DEMO;
|
||||
}
|
||||
|
||||
@@ -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