refactor: 관리자 스키마 타입 추가 및 엔티티 수정

This commit is contained in:
이상진 2025-09-14 16:37:24 +09:00
parent 18be393252
commit c33ec686f9
2 changed files with 26 additions and 2 deletions

View File

@ -10,16 +10,29 @@ import roomescape.common.entity.AuditingBaseEntity
class AdminEntity(
id: Long,
@Column(unique = true)
val account: String,
var password: String,
val name: String,
@Column(unique = true)
var phone: String,
@Enumerated(value = EnumType.STRING)
var permissionLevel: AdminPermissionLevel
val type: AdminType,
@Column(nullable = true)
var storeId: Long? = null,
@Enumerated(value = EnumType.STRING)
var permissionLevel: AdminPermissionLevel
) : AuditingBaseEntity(id)
enum class AdminType {
HQ,
STORE
}
enum class AdminPermissionLevel(
val privileges: Set<Privilege>
) {

View File

@ -74,11 +74,22 @@ create table if not exists admin(
password varchar(255) not null,
name varchar(20) not null,
phone varchar(20) not null,
type varchar(20) not null,
store_id bigint,
permission_level varchar(20) not null,
created_at timestamp not null,
created_by bigint not null,
updated_at timestamp not null,
updated_by bigint not null
updated_by bigint not null,
constraint uk_admin__account unique (account),
constraint uk_admin__phone unique (phone),
constraint chk_admin__type check (type in ('HQ', 'STORE')),
constraint chk_admin__store_id check (
(type = 'HQ' AND store_id IS NULL) OR
(type = 'STORE' AND store_id IS NOT NULL)
),
constraint fk_admin__store_id foreign key (store_id) references store (id)
);
create table if not exists login_history(