45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import { Router } from "express";
|
|
import {
|
|
getCascadingRelations,
|
|
getCascadingRelationById,
|
|
getCascadingRelationByCode,
|
|
createCascadingRelation,
|
|
updateCascadingRelation,
|
|
deleteCascadingRelation,
|
|
getCascadingOptions,
|
|
getParentOptions,
|
|
} from "../controllers/cascadingRelationController";
|
|
import { authenticateToken } from "../middleware/authMiddleware";
|
|
|
|
const router = Router();
|
|
|
|
// 모든 라우트에 인증 적용
|
|
router.use(authenticateToken);
|
|
|
|
// 연쇄 관계 목록 조회
|
|
router.get("/", getCascadingRelations);
|
|
|
|
// 연쇄 관계 상세 조회 (ID)
|
|
router.get("/:id", getCascadingRelationById);
|
|
|
|
// 연쇄 관계 코드로 조회
|
|
router.get("/code/:code", getCascadingRelationByCode);
|
|
|
|
// 🆕 연쇄 관계로 부모 옵션 조회 (상위 선택 역할용)
|
|
router.get("/parent-options/:code", getParentOptions);
|
|
|
|
// 연쇄 관계로 자식 옵션 조회 (실제 드롭다운에서 사용)
|
|
router.get("/options/:code", getCascadingOptions);
|
|
|
|
// 연쇄 관계 생성
|
|
router.post("/", createCascadingRelation);
|
|
|
|
// 연쇄 관계 수정
|
|
router.put("/:id", updateCascadingRelation);
|
|
|
|
// 연쇄 관계 삭제
|
|
router.delete("/:id", deleteCascadingRelation);
|
|
|
|
export default router;
|
|
|