File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
/**
* 공통코드 도메인 — 순수 데이터 표현, 외부 의존 없음.
*
* 백엔드 `TB_SYS_COM_CD_DTL`의 한 그룹(`COM_CD`)에 속한 상세코드 목록이며,
* `GET /api/v1/mngr/code/list/{comCd}`(ROLE_ADMIN)로 가져온다.
*/
export type CommonCode = {
/** 백엔드 `comDtlCd` — 저장·전송에 쓰는 코드값. */
code: string;
/** 백엔드 `cdNm` — 화면에 보이는 이름. */
label: string;
};
/** 코드 그룹 ID — 화면이 문자열을 직접 적지 않도록 여기 모은다. */
export const CODE_GROUP = {
/** 꾸미기 아이템 카테고리. */
decorationItemCategory: 'ITEM_CATE_CD',
} as const;
/** 코드값 → 이름. 목록에 없는 코드는 코드값 자체를 보여준다(이름을 지어내지 않는다). */
export function formatCommonCode(
codes: readonly CommonCode[],
code: string
): string {
return codes.find((item) => item.code === code)?.label ?? code;
}
export function isKnownCommonCode(
codes: readonly CommonCode[],
code: string
): boolean {
return codes.some((item) => item.code === code);
}