코드 활성/비활성화 해결

This commit is contained in:
dohyeons
2025-09-30 14:28:40 +09:00
parent 0b787b4c4c
commit 142f6a1a90
6 changed files with 80 additions and 39 deletions

View File

@@ -65,12 +65,26 @@ export class CommonCodeController {
// 프론트엔드가 기대하는 형식으로 데이터 변환
const transformedData = result.data.map((code: any) => ({
// 새로운 필드명 (카멜케이스)
codeValue: code.code_value,
codeName: code.code_name,
codeNameEng: code.code_name_eng,
description: code.description,
sortOrder: code.sort_order,
isActive: code.is_active === "Y",
isActive: code.is_active,
useYn: code.is_active,
// 기존 필드명도 유지 (하위 호환성)
code_category: code.code_category,
code_value: code.code_value,
code_name: code.code_name,
code_name_eng: code.code_name_eng,
sort_order: code.sort_order,
is_active: code.is_active,
created_date: code.created_date,
created_by: code.created_by,
updated_date: code.updated_date,
updated_by: code.updated_by,
}));
return res.json({

View File

@@ -276,8 +276,11 @@ export class CommonCodeService {
updatedBy: string
) {
try {
// 디버깅: 받은 데이터 로그
logger.info(`코드 수정 데이터:`, { categoryCode, codeValue, data });
// codeValue가 undefined이거나 빈 문자열인지 확인
if (!codeValue || codeValue === 'undefined') {
throw new Error(`잘못된 코드 값입니다: ${codeValue}`);
}
const code = await prisma.code_info.update({
where: {
code_category_code_value: {