generated from pricelees/issue-pr-template
refactor: 관리자 스키마 타입 추가 및 엔티티 수정
This commit is contained in:
parent
18be393252
commit
c33ec686f9
@ -10,16 +10,29 @@ import roomescape.common.entity.AuditingBaseEntity
|
|||||||
class AdminEntity(
|
class AdminEntity(
|
||||||
id: Long,
|
id: Long,
|
||||||
|
|
||||||
|
@Column(unique = true)
|
||||||
val account: String,
|
val account: String,
|
||||||
var password: String,
|
var password: String,
|
||||||
val name: String,
|
val name: String,
|
||||||
|
|
||||||
|
@Column(unique = true)
|
||||||
var phone: String,
|
var phone: String,
|
||||||
|
|
||||||
@Enumerated(value = EnumType.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)
|
) : AuditingBaseEntity(id)
|
||||||
|
|
||||||
|
enum class AdminType {
|
||||||
|
HQ,
|
||||||
|
STORE
|
||||||
|
}
|
||||||
|
|
||||||
enum class AdminPermissionLevel(
|
enum class AdminPermissionLevel(
|
||||||
val privileges: Set<Privilege>
|
val privileges: Set<Privilege>
|
||||||
) {
|
) {
|
||||||
|
|||||||
@ -74,11 +74,22 @@ create table if not exists admin(
|
|||||||
password varchar(255) not null,
|
password varchar(255) not null,
|
||||||
name varchar(20) not null,
|
name varchar(20) not null,
|
||||||
phone varchar(20) not null,
|
phone varchar(20) not null,
|
||||||
|
type varchar(20) not null,
|
||||||
|
store_id bigint,
|
||||||
permission_level varchar(20) not null,
|
permission_level varchar(20) not null,
|
||||||
created_at timestamp not null,
|
created_at timestamp not null,
|
||||||
created_by bigint not null,
|
created_by bigint not null,
|
||||||
updated_at timestamp 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(
|
create table if not exists login_history(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user