feat: add User entity and Role enum

This commit is contained in:
2026-02-21 20:04:23 +03:00
parent 32c96ae06b
commit 6a5061b93f
2 changed files with 71 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
package com.example.bankcards.entity;
public enum Role {
ROLE_USER,
ROLE_ADMIN
}

View File

@@ -0,0 +1,65 @@
package com.example.bankcards.entity;
import jakarta.persistence.*;
@Entity
@Table(name = "users")
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@Column(nullable = false, unique = true)
private String username;
@Column(nullable = false)
private String password;
@Column(nullable = false, unique = true)
private String email;
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private Role role;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public Role getRole() {
return role;
}
public void setRole(Role role) {
this.role = role;
}
}