init
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* 알림 라우트
|
||||
* 사용자 알림 관련 API
|
||||
*/
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const notificationController = require('../controllers/notificationController');
|
||||
const { check } = require('express-validator');
|
||||
const { authenticateJWT } = require('../middleware/authMiddleware');
|
||||
|
||||
// 사용자 알림 목록 가져오기
|
||||
router.get('/', authenticateJWT, notificationController.getUserNotifications);
|
||||
|
||||
// 알림 읽음 표시
|
||||
router.put('/:notificationId/read', authenticateJWT, notificationController.markAsRead);
|
||||
|
||||
// 모든 알림 읽음 표시
|
||||
router.put('/read-all', authenticateJWT, notificationController.markAllAsRead);
|
||||
|
||||
// 알림 삭제
|
||||
router.delete('/:notificationId', authenticateJWT, notificationController.deleteNotification);
|
||||
|
||||
// 알림 생성 (관리자 전용)
|
||||
router.post('/',
|
||||
authenticateJWT,
|
||||
[
|
||||
check('userId', '사용자 ID가 필요합니다.').not().isEmpty(),
|
||||
check('title', '알림 제목이 필요합니다.').not().isEmpty(),
|
||||
check('message', '알림 내용이 필요합니다.').not().isEmpty()
|
||||
],
|
||||
notificationController.createNotification
|
||||
);
|
||||
|
||||
module.exports = router;
|
||||
Reference in New Issue
Block a user