2025-10-01 11:34:17 +09:00
|
|
|
import { Router } from "express";
|
|
|
|
|
import reportController from "../controllers/reportController";
|
|
|
|
|
import { authenticateToken } from "../middleware/authMiddleware";
|
|
|
|
|
|
|
|
|
|
const router = Router();
|
|
|
|
|
|
|
|
|
|
// 모든 리포트 API는 인증이 필요
|
|
|
|
|
router.use(authenticateToken);
|
|
|
|
|
|
2025-10-01 14:36:46 +09:00
|
|
|
// 외부 DB 연결 목록 (구체적인 경로를 먼저 배치)
|
|
|
|
|
router.get("/external-connections", (req, res, next) =>
|
|
|
|
|
reportController.getExternalConnections(req, res, next)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 템플릿 관련 라우트
|
2025-10-01 11:34:17 +09:00
|
|
|
router.get("/templates", (req, res, next) =>
|
|
|
|
|
reportController.getTemplates(req, res, next)
|
|
|
|
|
);
|
|
|
|
|
router.post("/templates", (req, res, next) =>
|
|
|
|
|
reportController.createTemplate(req, res, next)
|
|
|
|
|
);
|
|
|
|
|
router.delete("/templates/:templateId", (req, res, next) =>
|
|
|
|
|
reportController.deleteTemplate(req, res, next)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 리포트 목록
|
|
|
|
|
router.get("/", (req, res, next) =>
|
|
|
|
|
reportController.getReports(req, res, next)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 리포트 생성
|
|
|
|
|
router.post("/", (req, res, next) =>
|
|
|
|
|
reportController.createReport(req, res, next)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 리포트 복사 (구체적인 경로를 먼저 배치)
|
|
|
|
|
router.post("/:reportId/copy", (req, res, next) =>
|
|
|
|
|
reportController.copyReport(req, res, next)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 레이아웃 관련 라우트
|
|
|
|
|
router.get("/:reportId/layout", (req, res, next) =>
|
|
|
|
|
reportController.getLayout(req, res, next)
|
|
|
|
|
);
|
|
|
|
|
router.put("/:reportId/layout", (req, res, next) =>
|
|
|
|
|
reportController.saveLayout(req, res, next)
|
|
|
|
|
);
|
|
|
|
|
|
2025-10-01 13:53:45 +09:00
|
|
|
// 쿼리 실행
|
|
|
|
|
router.post("/:reportId/queries/:queryId/execute", (req, res, next) =>
|
|
|
|
|
reportController.executeQuery(req, res, next)
|
|
|
|
|
);
|
|
|
|
|
|
2025-10-01 11:34:17 +09:00
|
|
|
// 리포트 상세
|
|
|
|
|
router.get("/:reportId", (req, res, next) =>
|
|
|
|
|
reportController.getReportById(req, res, next)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 리포트 수정
|
|
|
|
|
router.put("/:reportId", (req, res, next) =>
|
|
|
|
|
reportController.updateReport(req, res, next)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 리포트 삭제
|
|
|
|
|
router.delete("/:reportId", (req, res, next) =>
|
|
|
|
|
reportController.deleteReport(req, res, next)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export default router;
|