65 lines
1.7 KiB
TypeScript
65 lines
1.7 KiB
TypeScript
import { Router } from "express";
|
|
import reportController from "../controllers/reportController";
|
|
import { authenticateToken } from "../middleware/authMiddleware";
|
|
|
|
const router = Router();
|
|
|
|
// 모든 리포트 API는 인증이 필요
|
|
router.use(authenticateToken);
|
|
|
|
// 템플릿 관련 라우트 (구체적인 경로를 먼저 배치)
|
|
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)
|
|
);
|
|
|
|
// 쿼리 실행
|
|
router.post("/:reportId/queries/:queryId/execute", (req, res, next) =>
|
|
reportController.executeQuery(req, res, next)
|
|
);
|
|
|
|
// 리포트 상세
|
|
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;
|