summaryrefslogtreecommitdiff
path: root/lib/menu-v2/types.ts
diff options
context:
space:
mode:
authorjoonhoekim <26rote@gmail.com>2025-12-04 19:46:55 +0900
committerjoonhoekim <26rote@gmail.com>2025-12-04 19:46:55 +0900
commit04ed774ff60a83c00711d4e8615cb4122954dba5 (patch)
treebfc18b5c4c40de94596d307fdf76990593c0d868 /lib/menu-v2/types.ts
parent5699e866201566366981ae8399a835fc7fa9fa47 (diff)
(김준회) 메뉴 관리기능 초안 개발 (시딩 필요)
Diffstat (limited to 'lib/menu-v2/types.ts')
-rw-r--r--lib/menu-v2/types.ts103
1 files changed, 103 insertions, 0 deletions
diff --git a/lib/menu-v2/types.ts b/lib/menu-v2/types.ts
new file mode 100644
index 00000000..1be8a4fe
--- /dev/null
+++ b/lib/menu-v2/types.ts
@@ -0,0 +1,103 @@
+// lib/menu-v2/types.ts
+
+export type NodeType = 'menu_group' | 'group' | 'menu' | 'additional';
+export type MenuDomain = 'evcp' | 'partners';
+
+export interface MenuTreeNode {
+ id: number;
+ domain: MenuDomain;
+ parentId: number | null;
+ nodeType: NodeType;
+ sortOrder: number;
+ titleKo: string;
+ titleEn: string | null;
+ descriptionKo: string | null;
+ descriptionEn: string | null;
+ menuPath: string | null;
+ icon: string | null;
+ scrId: string | null;
+ isActive: boolean;
+ manager1Id: number | null;
+ manager2Id: number | null;
+ createdAt: Date;
+ updatedAt: Date;
+ // 조회 시 추가되는 필드
+ children?: MenuTreeNode[];
+}
+
+export interface DiscoveredMenu {
+ domain: MenuDomain;
+ menuPath: string;
+ pageFilePath: string;
+ routeGroup: string;
+}
+
+// 도메인별 앱 라우터 경로 설정
+export const DOMAIN_APP_PATHS: Record<MenuDomain, {
+ appDir: string;
+ basePath: string;
+}> = {
+ evcp: {
+ appDir: 'app/[lng]/evcp/(evcp)',
+ basePath: '/evcp'
+ },
+ partners: {
+ appDir: 'app/[lng]/partners',
+ basePath: '/partners'
+ }
+};
+
+// 관리자용 트리 조회 결과 타입
+// tree: 메뉴그룹(드롭다운) + 최상위 메뉴(단일 링크) 통합
+export interface MenuTreeAdminResult {
+ tree: MenuTreeNode[];
+ unassigned: MenuTreeNode[];
+}
+
+// 헤더용 트리 조회 결과 타입
+// tree: 메뉴그룹(드롭다운) + 최상위 메뉴(단일 링크) 통합
+export interface MenuTreeActiveResult {
+ tree: MenuTreeNode[];
+}
+
+// 노드 생성 타입
+export interface CreateMenuGroupInput {
+ titleKo: string;
+ titleEn?: string;
+ sortOrder?: number;
+}
+
+export interface CreateGroupInput {
+ parentId: number;
+ titleKo: string;
+ titleEn?: string;
+ sortOrder?: number;
+}
+
+// 최상위 메뉴 생성 (단일 링크)
+export interface CreateTopLevelMenuInput {
+ titleKo: string;
+ titleEn?: string;
+ menuPath: string;
+ sortOrder?: number;
+}
+
+// 노드 업데이트 타입
+export interface UpdateNodeInput {
+ titleKo?: string;
+ titleEn?: string;
+ descriptionKo?: string;
+ descriptionEn?: string;
+ isActive?: boolean;
+ scrId?: string;
+ icon?: string;
+ manager1Id?: number | null;
+ manager2Id?: number | null;
+}
+
+// 순서 변경 타입
+export interface ReorderNodeInput {
+ id: number;
+ sortOrder: number;
+}
+