2025-09-02 11:30:19 +09:00
|
|
|
import { Router } from "express";
|
|
|
|
|
import { CommonCodeController } from "../controllers/commonCodeController";
|
|
|
|
|
import { authenticateToken } from "../middleware/authMiddleware";
|
|
|
|
|
|
|
|
|
|
const router = Router();
|
|
|
|
|
const commonCodeController = new CommonCodeController();
|
|
|
|
|
|
|
|
|
|
// 모든 공통코드 API는 인증이 필요
|
|
|
|
|
router.use(authenticateToken);
|
|
|
|
|
|
|
|
|
|
// 카테고리 관련 라우트
|
|
|
|
|
router.get("/categories", (req, res) =>
|
|
|
|
|
commonCodeController.getCategories(req, res)
|
|
|
|
|
);
|
2025-09-03 11:20:43 +09:00
|
|
|
|
|
|
|
|
// 카테고리 중복 검사 (구체적인 경로를 먼저 배치)
|
|
|
|
|
router.get("/categories/check-duplicate", (req, res) =>
|
|
|
|
|
commonCodeController.checkCategoryDuplicate(req, res)
|
|
|
|
|
);
|
|
|
|
|
|
2025-09-02 11:30:19 +09:00
|
|
|
router.post("/categories", (req, res) =>
|
|
|
|
|
commonCodeController.createCategory(req, res)
|
|
|
|
|
);
|
|
|
|
|
router.put("/categories/:categoryCode", (req, res) =>
|
|
|
|
|
commonCodeController.updateCategory(req, res)
|
|
|
|
|
);
|
|
|
|
|
router.delete("/categories/:categoryCode", (req, res) =>
|
|
|
|
|
commonCodeController.deleteCategory(req, res)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 코드 관련 라우트
|
|
|
|
|
router.get("/categories/:categoryCode/codes", (req, res) =>
|
|
|
|
|
commonCodeController.getCodes(req, res)
|
|
|
|
|
);
|
|
|
|
|
router.post("/categories/:categoryCode/codes", (req, res) =>
|
|
|
|
|
commonCodeController.createCode(req, res)
|
|
|
|
|
);
|
2025-09-02 13:57:53 +09:00
|
|
|
|
2025-09-03 11:20:43 +09:00
|
|
|
// 코드 중복 검사 (구체적인 경로를 먼저 배치)
|
|
|
|
|
router.get("/categories/:categoryCode/codes/check-duplicate", (req, res) =>
|
|
|
|
|
commonCodeController.checkCodeDuplicate(req, res)
|
|
|
|
|
);
|
|
|
|
|
|
2025-09-02 13:57:53 +09:00
|
|
|
// 코드 순서 변경 (구체적인 경로를 먼저 배치)
|
|
|
|
|
router.put("/categories/:categoryCode/codes/reorder", (req, res) =>
|
|
|
|
|
commonCodeController.reorderCodes(req, res)
|
|
|
|
|
);
|
|
|
|
|
|
2025-09-02 11:30:19 +09:00
|
|
|
router.put("/categories/:categoryCode/codes/:codeValue", (req, res) =>
|
|
|
|
|
commonCodeController.updateCode(req, res)
|
|
|
|
|
);
|
|
|
|
|
router.delete("/categories/:categoryCode/codes/:codeValue", (req, res) =>
|
|
|
|
|
commonCodeController.deleteCode(req, res)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
// 화면관리용 옵션 조회
|
|
|
|
|
router.get("/categories/:categoryCode/options", (req, res) =>
|
|
|
|
|
commonCodeController.getCodeOptions(req, res)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export default router;
|