본인 수신자 추가/제거는 모든 인증 사용자 허용, 타인 수신자 관리는 관리자만 허용하도록 변경 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
29 lines
976 B
JavaScript
29 lines
976 B
JavaScript
// routes/notificationRecipientRoutes.js
|
|
const express = require('express');
|
|
const router = express.Router();
|
|
const controller = require('../controllers/notificationRecipientController');
|
|
const { requireAuth, requireAdmin } = require('../middleware/auth');
|
|
|
|
// 모든 라우트에 인증 필요
|
|
router.use(requireAuth);
|
|
|
|
// 알림 유형 목록
|
|
router.get('/types', controller.getTypes);
|
|
|
|
// 전체 수신자 목록 (유형별 그룹화)
|
|
router.get('/', controller.getAll);
|
|
|
|
// 유형별 수신자 조회
|
|
router.get('/:type', controller.getByType);
|
|
|
|
// 수신자 추가 (본인: 모든 사용자, 타인: 관리자만 — 컨트롤러에서 검증)
|
|
router.post('/', controller.add);
|
|
|
|
// 유형별 수신자 일괄 설정 (관리자만)
|
|
router.put('/:type', requireAdmin, controller.setRecipients);
|
|
|
|
// 수신자 제거 (본인: 모든 사용자, 타인: 관리자만 — 컨트롤러에서 검증)
|
|
router.delete('/:type/:userId', controller.remove);
|
|
|
|
module.exports = router;
|