외부 db연동 구현

This commit is contained in:
dohyeons
2025-10-01 14:36:46 +09:00
parent 12087cbdd7
commit 2ee4dd0b58
8 changed files with 212 additions and 18 deletions
@@ -335,13 +335,14 @@ export class ReportController {
async executeQuery(req: Request, res: Response, next: NextFunction) {
try {
const { reportId, queryId } = req.params;
const { parameters = {}, sqlQuery } = req.body;
const { parameters = {}, sqlQuery, externalConnectionId } = req.body;
const result = await reportService.executeQuery(
reportId,
queryId,
parameters,
sqlQuery
sqlQuery,
externalConnectionId
);
return res.json({
@@ -355,6 +356,31 @@ export class ReportController {
});
}
}
/**
* 외부 DB 연결 목록 조회 (활성화된 것만)
* GET /api/admin/reports/external-connections
*/
async getExternalConnections(
req: Request,
res: Response,
next: NextFunction
) {
try {
const { ExternalDbConnectionService } = await import(
"../services/externalDbConnectionService"
);
const result = await ExternalDbConnectionService.getConnections({
is_active: "Y",
company_code: req.body.companyCode || "",
});
return res.json(result);
} catch (error) {
return next(error);
}
}
}
export default new ReportController();