43 lines
1.0 KiB
Java
43 lines
1.0 KiB
Java
package org.example.model;
|
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
import jakarta.persistence.*;
|
|
import lombok.*;
|
|
import org.hibernate.annotations.CreationTimestamp;
|
|
|
|
import java.time.Instant;
|
|
import java.util.UUID;
|
|
|
|
@Entity
|
|
@Table(name = "users")
|
|
@Setter
|
|
@Getter
|
|
@AllArgsConstructor
|
|
@NoArgsConstructor
|
|
@Builder
|
|
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
|
|
public class User {
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.UUID)
|
|
private UUID id;
|
|
|
|
@Column(nullable = false, unique = true, length = 64)
|
|
private String username;
|
|
|
|
@Column(name = "display_name", nullable = false, length = 128)
|
|
@JsonProperty("display_name")
|
|
private String displayName;
|
|
|
|
@JsonIgnore
|
|
@Column(name = "password")
|
|
private String password;
|
|
|
|
@CreationTimestamp
|
|
@Column(name = "created_at", nullable = false, updatable = false)
|
|
@JsonProperty("created_at")
|
|
private Instant createdAt;
|
|
}
|