All checks were successful
continuous-integration/drone/push Build is passing
115 lines
2.2 KiB
Java
115 lines
2.2 KiB
Java
package wtf.beatrice.releasehive.models;
|
|
|
|
|
|
import jakarta.persistence.*;
|
|
import org.hibernate.annotations.CreationTimestamp;
|
|
import org.hibernate.annotations.UpdateTimestamp;
|
|
import org.springframework.security.core.GrantedAuthority;
|
|
import org.springframework.security.core.userdetails.UserDetails;
|
|
|
|
import java.util.Collection;
|
|
import java.util.Date;
|
|
import java.util.List;
|
|
import java.util.UUID;
|
|
|
|
@Entity
|
|
@Table(name="users")
|
|
public class User implements UserDetails
|
|
{
|
|
|
|
@Id
|
|
@GeneratedValue(strategy = GenerationType.UUID)
|
|
private UUID uuid;
|
|
|
|
@Column(nullable = false)
|
|
private String username;
|
|
|
|
@Column(unique = true, length = 64, nullable = false)
|
|
private String email;
|
|
|
|
@Column(nullable = false)
|
|
private String password;
|
|
|
|
@CreationTimestamp
|
|
@Column(updatable = false, name = "created_at")
|
|
private Date createdAt;
|
|
|
|
@UpdateTimestamp
|
|
@Column(name = "updated_at")
|
|
private Date updatedAt;
|
|
|
|
public UUID getUuid() {
|
|
return uuid;
|
|
}
|
|
|
|
@Override
|
|
public String getUsername() {
|
|
return username;
|
|
}
|
|
|
|
@Override
|
|
public boolean isAccountNonExpired() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean isAccountNonLocked() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean isCredentialsNonExpired() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public boolean isEnabled() {
|
|
return true;
|
|
}
|
|
|
|
public void setUsername(String username) {
|
|
this.username = username;
|
|
}
|
|
|
|
@Override
|
|
public Collection<? extends GrantedAuthority> getAuthorities() {
|
|
return List.of();
|
|
}
|
|
|
|
public String getPassword() {
|
|
return password;
|
|
}
|
|
|
|
public void setPassword(String password) {
|
|
this.password = password;
|
|
}
|
|
|
|
public void setUuid(UUID uuid) {
|
|
this.uuid = uuid;
|
|
}
|
|
|
|
public Date getCreatedAt() {
|
|
return createdAt;
|
|
}
|
|
|
|
public void setCreatedAt(Date createdAt) {
|
|
this.createdAt = createdAt;
|
|
}
|
|
|
|
public Date getUpdatedAt() {
|
|
return updatedAt;
|
|
}
|
|
|
|
public void setUpdatedAt(Date updatedAt) {
|
|
this.updatedAt = updatedAt;
|
|
}
|
|
|
|
public String getEmail() {
|
|
return email;
|
|
}
|
|
|
|
public void setEmail(String email) {
|
|
this.email = email;
|
|
}
|
|
}
|