/** * ๐Ÿ”ฅ ๋ฒ„ํŠผ ๋ฐ์ดํ„ฐํ”Œ๋กœ์šฐ ๋ผ์šฐํŠธ * * ์„ฑ๋Šฅ ์ตœ์ ํ™”๋œ API ์—”๋“œํฌ์ธํŠธ๋“ค */ import express from "express"; import { getButtonDataflowConfig, updateButtonDataflowConfig, getAvailableDiagrams, getDiagramRelationships, getRelationshipPreview, executeOptimizedButton, executeSimpleDataflow, getJobStatus, getJoinRelationship, } from "../controllers/buttonDataflowController"; import { authenticateToken } from "../middleware/authMiddleware"; const router = express.Router(); // ๐Ÿ”ฅ ๋ชจ๋“  ๋ผ์šฐํŠธ์— ์ธ์ฆ ๋ฏธ๋“ค์›จ์–ด ์ ์šฉ router.use(authenticateToken); // ============================================================================ // ๐Ÿ”ฅ ๋ฒ„ํŠผ ์„ค์ • ๊ด€๋ฆฌ // ============================================================================ // ๋ฒ„ํŠผ๋ณ„ ์ œ์–ด๊ด€๋ฆฌ ์„ค์ • ์กฐํšŒ router.get("/config/:buttonId", getButtonDataflowConfig); // ๋ฒ„ํŠผ๋ณ„ ์ œ์–ด๊ด€๋ฆฌ ์„ค์ • ์—…๋ฐ์ดํŠธ router.put("/config/:buttonId", updateButtonDataflowConfig); // ============================================================================ // ๐Ÿ”ฅ ๊ด€๊ณ„๋„ ๋ฐ ๊ด€๊ณ„ ์ •๋ณด ์กฐํšŒ // ============================================================================ // ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ๊ด€๊ณ„๋„ ๋ชฉ๋ก ์กฐํšŒ router.get("/diagrams", getAvailableDiagrams); // ํŠน์ • ๊ด€๊ณ„๋„์˜ ๊ด€๊ณ„ ๋ชฉ๋ก ์กฐํšŒ router.get("/diagrams/:diagramId/relationships", getDiagramRelationships); // ๊ด€๊ณ„ ๋ฏธ๋ฆฌ๋ณด๊ธฐ ์ •๋ณด ์กฐํšŒ router.get( "/diagrams/:diagramId/relationships/:relationshipId/preview", getRelationshipPreview ); // ============================================================================ // ๐Ÿ”ฅ ๋ฒ„ํŠผ ์‹คํ–‰ (์„ฑ๋Šฅ ์ตœ์ ํ™”) // ============================================================================ // ์ตœ์ ํ™”๋œ ๋ฒ„ํŠผ ์‹คํ–‰ (์ฆ‰์‹œ ์‘๋‹ต + ๋ฐฑ๊ทธ๋ผ์šด๋“œ) router.post("/execute-optimized", executeOptimizedButton); // ๊ฐ„๋‹จํ•œ ๋ฐ์ดํ„ฐํ”Œ๋กœ์šฐ ์ฆ‰์‹œ ์‹คํ–‰ router.post("/execute-simple", executeSimpleDataflow); // ๋ฐฑ๊ทธ๋ผ์šด๋“œ ์ž‘์—… ์ƒํƒœ ์กฐํšŒ router.get("/job-status/:jobId", getJobStatus); // ============================================================================ // ๐Ÿ”ฅ ํ…Œ์ด๋ธ” ๊ด€๊ณ„ ์กฐํšŒ (๋งˆ์Šคํ„ฐ-๋””ํ…Œ์ผ ์ €์žฅ์šฉ) // ============================================================================ // ๋‘ ํ…Œ์ด๋ธ” ๊ฐ„์˜ ์กฐ์ธ ๊ด€๊ณ„ ์กฐํšŒ router.get("/join-relationship/:mainTable/:detailTable", getJoinRelationship); // ============================================================================ // ๐Ÿ”ฅ ๋ ˆ๊ฑฐ์‹œ ํ˜ธํ™˜์„ฑ (๊ธฐ์กด API์™€ ํ˜ธํ™˜) // ============================================================================ // ๊ธฐ์กด ์‹คํ–‰ API (redirect to optimized) router.post("/execute", executeOptimizedButton); // ๋ฐฑ๊ทธ๋ผ์šด๋“œ ์‹คํ–‰ API (์‹ค์ œ๋กœ๋Š” optimized์™€ ๋™์ผ) router.post("/execute-background", executeOptimizedButton); export default router;