Merge branch 'main' of http://39.117.244.52:3000/kjs/ERP-node into feat/dashboard

This commit is contained in:
dohyeons
2025-11-04 09:44:09 +09:00
16 changed files with 2428 additions and 727 deletions

View File

@@ -12,6 +12,14 @@ export const saveFormData = async (
const { companyCode, userId } = req.user as any;
const { screenId, tableName, data } = req.body;
// 🔍 디버깅: 사용자 정보 확인
console.log("🔍 [saveFormData] 사용자 정보:", {
userId,
companyCode,
reqUser: req.user,
dataWriter: data.writer,
});
// 필수 필드 검증 (screenId는 0일 수 있으므로 undefined 체크)
if (screenId === undefined || screenId === null || !tableName || !data) {
return res.status(400).json({
@@ -25,9 +33,12 @@ export const saveFormData = async (
...data,
created_by: userId,
updated_by: userId,
writer: data.writer || userId, // ✅ writer가 없으면 userId로 설정
screen_id: screenId,
};
console.log("✅ [saveFormData] 최종 writer 값:", formDataWithMeta.writer);
// company_code는 사용자가 명시적으로 입력한 경우에만 추가
if (data.company_code !== undefined) {
formDataWithMeta.company_code = data.company_code;
@@ -86,6 +97,7 @@ export const saveFormDataEnhanced = async (
...data,
created_by: userId,
updated_by: userId,
writer: data.writer || userId, // ✅ writer가 없으면 userId로 설정
screen_id: screenId,
};
@@ -134,6 +146,7 @@ export const updateFormData = async (
const formDataWithMeta = {
...data,
updated_by: userId,
writer: data.writer || userId, // ✅ writer가 없으면 userId로 설정
updated_at: new Date(),
};
@@ -186,6 +199,7 @@ export const updateFormDataPartial = async (
const newDataWithMeta = {
...newData,
updated_by: userId,
writer: newData.writer || userId, // ✅ writer가 없으면 userId로 설정
};
const result = await dynamicFormService.updateFormDataPartial(

View File

@@ -363,7 +363,7 @@ export class DDLExecutionService {
"id" varchar(500) PRIMARY KEY DEFAULT gen_random_uuid()::text,
"created_date" timestamp DEFAULT now(),
"updated_date" timestamp DEFAULT now(),
"writer" varchar(500),
"writer" varchar(500) DEFAULT NULL,
"company_code" varchar(500)`;
// 최종 CREATE TABLE 쿼리

View File

@@ -1502,6 +1502,9 @@ export class TableManagementService {
LIMIT $${paramIndex} OFFSET $${paramIndex + 1}
`;
logger.info(`🔍 실행할 SQL: ${dataQuery}`);
logger.info(`🔍 파라미터: ${JSON.stringify([...searchValues, size, offset])}`);
let data = await query<any>(dataQuery, [...searchValues, size, offset]);
// 🎯 파일 컬럼이 있으면 파일 정보 보강