[#44] 매장 기능 도입 #45

Merged
pricelees merged 116 commits from feat/#44 into main 2025-09-20 03:15:06 +00:00
2 changed files with 26 additions and 2 deletions
Showing only changes of commit c33ec686f9 - Show all commits

View File

@ -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>
) { ) {

View File

@ -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(