38 lines
1.4 KiB
TypeScript
38 lines
1.4 KiB
TypeScript
|
|
import { Router } from 'express';
|
||
|
|
import { DashboardController } from '../controllers/DashboardController';
|
||
|
|
import { authenticateToken } from '../middleware/authMiddleware';
|
||
|
|
|
||
|
|
const router = Router();
|
||
|
|
const dashboardController = new DashboardController();
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 대시보드 API 라우트
|
||
|
|
*
|
||
|
|
* 모든 엔드포인트는 인증이 필요하지만,
|
||
|
|
* 공개 대시보드 조회는 인증 없이도 가능
|
||
|
|
*/
|
||
|
|
|
||
|
|
// 공개 대시보드 목록 조회 (인증 불필요)
|
||
|
|
router.get('/public', dashboardController.getDashboards.bind(dashboardController));
|
||
|
|
|
||
|
|
// 공개 대시보드 상세 조회 (인증 불필요)
|
||
|
|
router.get('/public/:id', dashboardController.getDashboard.bind(dashboardController));
|
||
|
|
|
||
|
|
// 쿼리 실행 (인증 불필요 - 개발용)
|
||
|
|
router.post('/execute-query', dashboardController.executeQuery.bind(dashboardController));
|
||
|
|
|
||
|
|
// 인증이 필요한 라우트들
|
||
|
|
router.use(authenticateToken);
|
||
|
|
|
||
|
|
// 내 대시보드 목록 조회
|
||
|
|
router.get('/my', dashboardController.getMyDashboards.bind(dashboardController));
|
||
|
|
|
||
|
|
// 대시보드 CRUD
|
||
|
|
router.post('/', dashboardController.createDashboard.bind(dashboardController));
|
||
|
|
router.get('/', dashboardController.getDashboards.bind(dashboardController));
|
||
|
|
router.get('/:id', dashboardController.getDashboard.bind(dashboardController));
|
||
|
|
router.put('/:id', dashboardController.updateDashboard.bind(dashboardController));
|
||
|
|
router.delete('/:id', dashboardController.deleteDashboard.bind(dashboardController));
|
||
|
|
|
||
|
|
export default router;
|