- notificationRecipientModel에 ntfy CRUD 메서드 추가 (같은 DB 직접 쿼리) - ntfy 라우트 3개 추가 (GET/POST/DELETE, /:type 위에 배치) - 알림 수신자 탭 상단에 ntfy 구독 관리 카드 렌더링 - ntfy 추가 모달에 앱 설정 안내 문구 포함 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
34 lines
1.2 KiB
JavaScript
34 lines
1.2 KiB
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);
|
|
|
|
// ntfy 구독 관리 (/:type보다 위에 배치해야 "ntfy"를 type으로 잡지 않음)
|
|
router.get('/ntfy', controller.getNtfySubscribers);
|
|
router.post('/ntfy/:userId', controller.addNtfySubscription);
|
|
router.delete('/ntfy/:userId', controller.removeNtfySubscription);
|
|
|
|
// 유형별 수신자 조회
|
|
router.get('/:type', controller.getByType);
|
|
|
|
// 수신자 추가 (본인: 모든 사용자, 타인: 관리자만 — 컨트롤러에서 검증)
|
|
router.post('/', controller.add);
|
|
|
|
// 유형별 수신자 일괄 설정 (관리자만)
|
|
router.put('/:type', requireAdmin, controller.setRecipients);
|
|
|
|
// 수신자 제거 (본인: 모든 사용자, 타인: 관리자만 — 컨트롤러에서 검증)
|
|
router.delete('/:type/:userId', controller.remove);
|
|
|
|
module.exports = router;
|