컴포넌트 화면편집기에 배치

This commit is contained in:
kjs
2025-09-10 14:09:32 +09:00
parent 3bf694ce24
commit 01860df8d7
56 changed files with 4572 additions and 778 deletions

View File

@@ -131,9 +131,16 @@ class ComponentStandardService {
);
}
// 'active' 필드를 'is_active'로 변환
const createData = { ...data };
if ("active" in createData) {
createData.is_active = (createData as any).active;
delete (createData as any).active;
}
const component = await prisma.component_standards.create({
data: {
...data,
...createData,
created_date: new Date(),
updated_date: new Date(),
},
@@ -151,10 +158,17 @@ class ComponentStandardService {
) {
const existing = await this.getComponent(component_code);
// 'active' 필드를 'is_active'로 변환
const updateData = { ...data };
if ("active" in updateData) {
updateData.is_active = (updateData as any).active;
delete (updateData as any).active;
}
const component = await prisma.component_standards.update({
where: { component_code },
data: {
...data,
...updateData,
updated_date: new Date(),
},
});
@@ -216,21 +230,19 @@ class ComponentStandardService {
data: {
component_code: new_code,
component_name: new_name,
component_name_eng: source.component_name_eng,
description: source.description,
category: source.category,
icon_name: source.icon_name,
default_size: source.default_size as any,
component_config: source.component_config as any,
preview_image: source.preview_image,
sort_order: source.sort_order,
is_active: source.is_active,
is_public: source.is_public,
company_code: source.company_code,
component_name_eng: source?.component_name_eng,
description: source?.description,
category: source?.category,
icon_name: source?.icon_name,
default_size: source?.default_size as any,
component_config: source?.component_config as any,
preview_image: source?.preview_image,
sort_order: source?.sort_order,
is_active: source?.is_active,
is_public: source?.is_public,
company_code: source?.company_code || "DEFAULT",
created_date: new Date(),
created_by: source.created_by,
updated_date: new Date(),
updated_by: source.updated_by,
},
});
@@ -297,6 +309,27 @@ class ComponentStandardService {
})),
};
}
/**
* 컴포넌트 코드 중복 체크
*/
async checkDuplicate(
component_code: string,
company_code?: string
): Promise<boolean> {
const whereClause: any = { component_code };
// 회사 코드가 있고 "*"가 아닌 경우에만 조건 추가
if (company_code && company_code !== "*") {
whereClause.company_code = company_code;
}
const existingComponent = await prisma.component_standards.findFirst({
where: whereClause,
});
return !!existingComponent;
}
}
export default new ComponentStandardService();