Files
invyone/frontend/lib/queryKeys.ts
T
DDD1542 2348800e68
Build & Deploy to K8s / build-and-deploy (push) Successful in 9m22s
refactor(common-code): 마스터-디테일 재설계 — code_info(그룹) + code_detail(재귀 트리)
카테고리/캐스케이딩 시스템 (B/C/D) 전부 폐기:
- BE: mapper/Service/Controller 9세트 삭제 (cascading*, categoryTree, tableCategoryValue, categoryValueCascading, codeMerge)
- FE: 페이지 3 + API 8 + hooks 2 + 폐기 컴포넌트 6 삭제, 14곳 의존성 정리
- DB: 12 테이블 DROP, TABLE_TYPE_COLUMNS.CODE_CATEGORY → CODE_INFO rename

신설 commonCode 마스터-디테일:
- code_info: 1레벨 그룹 마스터
- code_detail: 2~∞ depth 재귀 트리 (parent_detail_id self-FK, depth 자동 계산)
- API: /api/common-codes/{info,detail}
- CodeCategoryFormModal/Panel → CodeInfoFormModal/Panel rename
- code_category 컬럼명 전부 code_info 로 치환 (mapper/Java/FE)
- 옛 commonCode API URL (/categories/...) → getCodeOptions 어댑터 + /detail?code_info=... 전환

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 16:50:50 +09:00

55 lines
1.9 KiB
TypeScript

/**
* React Query Key Factory
* 일관된 쿼리 키 관리를 위한 팩토리 함수들
*
* 공통코드 키 구조 (2026-05-15 마스터-디테일 재작성 기준):
* codeInfo — 그룹 마스터
* codeDetail — 트리 노드
*/
type FilterShape = { active?: boolean; search?: string };
export const queryKeys = {
// code_info (그룹 마스터)
codeInfo: {
all: ["code_info"] as const,
lists: () => [...queryKeys.codeInfo.all, "list"] as const,
list: (filters?: FilterShape) => [...queryKeys.codeInfo.lists(), filters] as const,
infiniteList: (filters?: FilterShape) =>
[...queryKeys.codeInfo.all, "infiniteList", filters] as const,
details: () => [...queryKeys.codeInfo.all, "detail"] as const,
detail: (codeInfo: string) => [...queryKeys.codeInfo.details(), codeInfo] as const,
},
// code_detail (디테일 트리 노드)
codeDetail: {
all: ["code_detail"] as const,
trees: () => [...queryKeys.codeDetail.all, "tree"] as const,
tree: (codeInfo: string, filters?: FilterShape) =>
[...queryKeys.codeDetail.trees(), codeInfo, filters] as const,
details: () => [...queryKeys.codeDetail.all, "detail"] as const,
detail: (codeDetailId: number | string) =>
[...queryKeys.codeDetail.details(), codeDetailId] as const,
},
// 옵션 (화면관리 등 연계용)
options: {
all: ["options"] as const,
byCodeInfo: (codeInfo: string) => [...queryKeys.options.all, codeInfo] as const,
},
// 중복 검사
validation: {
all: ["validation"] as const,
codeInfoDuplicate: (field: string, value: string, excludeCode?: string) =>
[...queryKeys.validation.all, "code_info", field, value, excludeCode] as const,
codeDetailDuplicate: (
codeInfo: string,
field: string,
value: string,
excludeId?: number | string,
) =>
[...queryKeys.validation.all, "code_detail", codeInfo, field, value, excludeId] as const,
},
} as const;