단순 키 연결 구현 시 증계 테입르에 레코드 생성 구현
This commit is contained in:
@@ -366,12 +366,8 @@ export async function createDataLink(
|
||||
relationshipId,
|
||||
fromTableName,
|
||||
fromColumnName,
|
||||
fromKeyValue,
|
||||
fromRecordId,
|
||||
toTableName,
|
||||
toColumnName,
|
||||
toKeyValue,
|
||||
toRecordId,
|
||||
connectionType,
|
||||
bridgeData,
|
||||
} = req.body;
|
||||
@@ -381,10 +377,8 @@ export async function createDataLink(
|
||||
!relationshipId ||
|
||||
!fromTableName ||
|
||||
!fromColumnName ||
|
||||
!fromKeyValue ||
|
||||
!toTableName ||
|
||||
!toColumnName ||
|
||||
!toKeyValue ||
|
||||
!connectionType
|
||||
) {
|
||||
const response: ApiResponse<null> = {
|
||||
@@ -393,7 +387,7 @@ export async function createDataLink(
|
||||
error: {
|
||||
code: "MISSING_REQUIRED_FIELDS",
|
||||
details:
|
||||
"필수 필드: relationshipId, fromTableName, fromColumnName, fromKeyValue, toTableName, toColumnName, toKeyValue, connectionType",
|
||||
"필수 필드: relationshipId, fromTableName, fromColumnName, toTableName, toColumnName, connectionType",
|
||||
},
|
||||
};
|
||||
res.status(400).json(response);
|
||||
@@ -409,12 +403,8 @@ export async function createDataLink(
|
||||
relationshipId,
|
||||
fromTableName,
|
||||
fromColumnName,
|
||||
fromKeyValue,
|
||||
fromRecordId,
|
||||
toTableName,
|
||||
toColumnName,
|
||||
toKeyValue,
|
||||
toRecordId,
|
||||
connectionType,
|
||||
companyCode,
|
||||
bridgeData,
|
||||
@@ -551,3 +541,70 @@ export async function deleteDataLink(
|
||||
res.status(500).json(response);
|
||||
}
|
||||
}
|
||||
|
||||
// ==================== 테이블 데이터 조회 ====================
|
||||
|
||||
/**
|
||||
* 테이블 실제 데이터 조회 (페이징)
|
||||
* GET /api/dataflow/table-data/:tableName
|
||||
*/
|
||||
export async function getTableData(req: Request, res: Response): Promise<void> {
|
||||
try {
|
||||
const { tableName } = req.params;
|
||||
const {
|
||||
page = "1",
|
||||
limit = "10",
|
||||
search = "",
|
||||
searchColumn = "",
|
||||
} = req.query;
|
||||
|
||||
if (!tableName) {
|
||||
const response: ApiResponse<null> = {
|
||||
success: false,
|
||||
message: "테이블명이 필요합니다.",
|
||||
error: {
|
||||
code: "MISSING_TABLE_NAME",
|
||||
details: "테이블명을 제공해주세요.",
|
||||
},
|
||||
};
|
||||
res.status(400).json(response);
|
||||
return;
|
||||
}
|
||||
|
||||
const pageNum = parseInt(page as string) || 1;
|
||||
const limitNum = parseInt(limit as string) || 10;
|
||||
const userInfo = (req as any).user;
|
||||
const companyCode = userInfo?.company_code || "*";
|
||||
|
||||
const dataflowService = new DataflowService();
|
||||
const result = await dataflowService.getTableData(
|
||||
tableName,
|
||||
pageNum,
|
||||
limitNum,
|
||||
search as string,
|
||||
searchColumn as string,
|
||||
companyCode
|
||||
);
|
||||
|
||||
const response: ApiResponse<typeof result> = {
|
||||
success: true,
|
||||
message: "테이블 데이터를 성공적으로 조회했습니다.",
|
||||
data: result,
|
||||
};
|
||||
|
||||
res.status(200).json(response);
|
||||
} catch (error) {
|
||||
logger.error("테이블 데이터 조회 중 오류 발생:", error);
|
||||
|
||||
const response: ApiResponse<null> = {
|
||||
success: false,
|
||||
message: "테이블 데이터 조회 중 오류가 발생했습니다.",
|
||||
error: {
|
||||
code: "TABLE_DATA_GET_ERROR",
|
||||
details: error instanceof Error ? error.message : "Unknown error",
|
||||
},
|
||||
};
|
||||
|
||||
res.status(500).json(response);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user