[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.persistence.Column;
|
||||
import jakarta.persistence.Table;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import jakarta.ws.rs.DefaultValue;
|
||||
|
||||
@Table(name = "user")
|
||||
@DataIfNotExists
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class User extends GenericDataSoftDelete {
|
||||
@NotNull
|
||||
@Column(length = 128)
|
||||
@Size(min = 3, max = 128)
|
||||
@Pattern(regexp = "^[a-zA-Z0-9-_ \\.]+$")
|
||||
public String login = null;
|
||||
|
||||
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
|
||||
public Timestamp lastConnection = null;
|
||||
@DefaultValue("'0'")
|
||||
@Column(nullable = false)
|
||||
public boolean admin = false;
|
||||
|
||||
@DefaultValue("'0'")
|
||||
@Column(nullable = false)
|
||||
public boolean blocked = false;
|
||||
@DefaultValue("'0'")
|
||||
@Column(nullable = false)
|
||||
public boolean removed = false;
|
||||
@Column(length = 512)
|
||||
public String blockedReason;
|
||||
|
||||
@Schema(description = "List of Id of the specific covers")
|
||||
@DataJson(targetEntity = Data.class)
|
||||
@ -56,7 +59,8 @@ public class User extends GenericDataSoftDelete {
|
||||
|
||||
@Override
|
||||
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