[FEAT] add control on User JPA
This commit is contained in:
parent
ebe88e4a8d
commit
96cb8a6e16
@ -28,26 +28,29 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import jakarta.annotation.Nullable;
|
import jakarta.annotation.Nullable;
|
||||||
import jakarta.persistence.Column;
|
import jakarta.persistence.Column;
|
||||||
import jakarta.persistence.Table;
|
import jakarta.persistence.Table;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import jakarta.validation.constraints.Pattern;
|
||||||
|
import jakarta.validation.constraints.Size;
|
||||||
import jakarta.ws.rs.DefaultValue;
|
import jakarta.ws.rs.DefaultValue;
|
||||||
|
|
||||||
@Table(name = "user")
|
@Table(name = "user")
|
||||||
@DataIfNotExists
|
@DataIfNotExists
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
public class User extends GenericDataSoftDelete {
|
public class User extends GenericDataSoftDelete {
|
||||||
|
@NotNull
|
||||||
@Column(length = 128)
|
@Column(length = 128)
|
||||||
|
@Size(min = 3, max = 128)
|
||||||
|
@Pattern(regexp = "^[a-zA-Z0-9-_ \\.]+$")
|
||||||
public String login = null;
|
public String login = null;
|
||||||
|
|
||||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
|
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
|
||||||
public Timestamp lastConnection = null;
|
public Timestamp lastConnection = null;
|
||||||
@DefaultValue("'0'")
|
|
||||||
@Column(nullable = false)
|
|
||||||
public boolean admin = false;
|
|
||||||
@DefaultValue("'0'")
|
@DefaultValue("'0'")
|
||||||
@Column(nullable = false)
|
@Column(nullable = false)
|
||||||
public boolean blocked = false;
|
public boolean blocked = false;
|
||||||
@DefaultValue("'0'")
|
@Column(length = 512)
|
||||||
@Column(nullable = false)
|
public String blockedReason;
|
||||||
public boolean removed = false;
|
|
||||||
|
|
||||||
@Schema(description = "List of Id of the specific covers")
|
@Schema(description = "List of Id of the specific covers")
|
||||||
@DataJson(targetEntity = Data.class)
|
@DataJson(targetEntity = Data.class)
|
||||||
@ -56,7 +59,8 @@ public class User extends GenericDataSoftDelete {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "User [login=" + this.login + ", last=" + this.lastConnection + ", admin=" + this.admin + "]";
|
return "User [login=" + this.login + ", last=" + this.lastConnection + ", blocked=" + this.blocked
|
||||||
|
+ ", blockedReason=" + this.blockedReason + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user