테이블 간 조인 관계 조회 기능 추가
- 두 테이블 간의 조인 관계를 조회하는 API를 추가하였습니다. 이 API는 메인 테이블과 디테일 테이블을 파라미터로 받아, 해당 테이블 간의 조인 관계를 반환합니다. - DataflowService에 조인 관계 조회 메서드를 구현하여, 회사 코드에 따라 적절한 조인 정보를 필터링합니다. - 프론트엔드에서 조인 관계를 캐시하여, 반복적인 API 호출을 줄이고 성능을 개선하였습니다. 이로 인해 마스터-디테일 저장 기능의 효율성이 향상되었습니다.
This commit is contained in:
@@ -759,3 +759,45 @@ export async function getAllRelationships(
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 두 테이블 간의 조인 관계 조회 (마스터-디테일 저장용)
|
||||
*/
|
||||
export async function getJoinRelationship(
|
||||
req: AuthenticatedRequest,
|
||||
res: Response
|
||||
): Promise<void> {
|
||||
try {
|
||||
const { mainTable, detailTable } = req.params;
|
||||
const companyCode = req.user?.companyCode || "*";
|
||||
|
||||
if (!mainTable || !detailTable) {
|
||||
res.status(400).json({
|
||||
success: false,
|
||||
message: "메인 테이블과 디테일 테이블이 필요합니다.",
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
// DataflowService에서 조인 관계 조회
|
||||
const { DataflowService } = await import("../services/dataflowService");
|
||||
const dataflowService = new DataflowService();
|
||||
|
||||
const result = await dataflowService.getJoinRelationshipBetweenTables(
|
||||
mainTable,
|
||||
detailTable,
|
||||
companyCode
|
||||
);
|
||||
|
||||
res.json({
|
||||
success: true,
|
||||
data: result,
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error("조인 관계 조회 실패:", error);
|
||||
res.status(500).json({
|
||||
success: false,
|
||||
message: error instanceof Error ? error.message : "조인 관계 조회 실패",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user