digramId를 사용해 제어 관계 그룹화
This commit is contained in:
@@ -15,6 +15,7 @@ export async function createTableRelationship(
|
||||
logger.info("=== 테이블 관계 생성 시작 ===");
|
||||
|
||||
const {
|
||||
diagramId,
|
||||
relationshipName,
|
||||
fromTableName,
|
||||
fromColumnName,
|
||||
@@ -52,6 +53,7 @@ export async function createTableRelationship(
|
||||
|
||||
const dataflowService = new DataflowService();
|
||||
const relationship = await dataflowService.createTableRelationship({
|
||||
diagramId: diagramId ? parseInt(diagramId) : undefined,
|
||||
relationshipName,
|
||||
fromTableName,
|
||||
fromColumnName,
|
||||
@@ -828,7 +830,62 @@ export async function deleteDiagram(
|
||||
}
|
||||
|
||||
/**
|
||||
* relationship_id로 관계도 관계 조회
|
||||
* diagram_id로 관계도 관계 조회
|
||||
*/
|
||||
export async function getDiagramRelationshipsByDiagramId(
|
||||
req: AuthenticatedRequest,
|
||||
res: Response
|
||||
): Promise<void> {
|
||||
try {
|
||||
const { diagramId } = req.params;
|
||||
const companyCode = (req.user as any)?.company_code || "*";
|
||||
|
||||
if (!diagramId) {
|
||||
const response: ApiResponse<null> = {
|
||||
success: false,
|
||||
message: "관계도 ID가 필요합니다.",
|
||||
error: {
|
||||
code: "MISSING_DIAGRAM_ID",
|
||||
details: "diagramId 파라미터가 필요합니다.",
|
||||
},
|
||||
};
|
||||
res.status(400).json(response);
|
||||
return;
|
||||
}
|
||||
|
||||
const dataflowService = new DataflowService();
|
||||
const relationships =
|
||||
await dataflowService.getDiagramRelationshipsByDiagramId(
|
||||
companyCode,
|
||||
parseInt(diagramId)
|
||||
);
|
||||
|
||||
const response: ApiResponse<any[]> = {
|
||||
success: true,
|
||||
message: "관계도 관계 목록을 성공적으로 조회했습니다.",
|
||||
data: relationships,
|
||||
};
|
||||
|
||||
res.status(200).json(response);
|
||||
} catch (error) {
|
||||
logger.error("관계도 관계 조회 실패:", error);
|
||||
const response: ApiResponse<null> = {
|
||||
success: false,
|
||||
message: "관계도 관계 조회에 실패했습니다.",
|
||||
error: {
|
||||
code: "DIAGRAM_RELATIONSHIPS_FETCH_FAILED",
|
||||
details:
|
||||
error instanceof Error
|
||||
? error.message
|
||||
: "알 수 없는 오류가 발생했습니다.",
|
||||
},
|
||||
};
|
||||
res.status(500).json(response);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* relationship_id로 관계도 관계 조회 (하위 호환성 유지)
|
||||
*/
|
||||
export async function getDiagramRelationshipsByRelationshipId(
|
||||
req: AuthenticatedRequest,
|
||||
@@ -852,10 +909,11 @@ export async function getDiagramRelationshipsByRelationshipId(
|
||||
}
|
||||
|
||||
const dataflowService = new DataflowService();
|
||||
const relationships = await dataflowService.getDiagramRelationshipsByRelationshipId(
|
||||
companyCode,
|
||||
parseInt(relationshipId)
|
||||
);
|
||||
const relationships =
|
||||
await dataflowService.getDiagramRelationshipsByRelationshipId(
|
||||
companyCode,
|
||||
parseInt(relationshipId)
|
||||
);
|
||||
|
||||
const response: ApiResponse<any[]> = {
|
||||
success: true,
|
||||
@@ -871,7 +929,10 @@ export async function getDiagramRelationshipsByRelationshipId(
|
||||
message: "관계도 관계 조회에 실패했습니다.",
|
||||
error: {
|
||||
code: "DIAGRAM_RELATIONSHIPS_FETCH_FAILED",
|
||||
details: error instanceof Error ? error.message : "알 수 없는 오류가 발생했습니다.",
|
||||
details:
|
||||
error instanceof Error
|
||||
? error.message
|
||||
: "알 수 없는 오류가 발생했습니다.",
|
||||
},
|
||||
};
|
||||
res.status(500).json(response);
|
||||
|
||||
Reference in New Issue
Block a user