feat(tkuser): 알림 시스템 이관 system1-factory → tkuser
- Phase 1: tkuser에 알림 CRUD, Push/ntfy 발송, 내부 알림 API 추가 - Phase 2: notifyHelper URL을 tkuser-api:3000으로 전환 (system2, tkpurchase, tksafety, system1) - Phase 3: notification-bell.js API 도메인 tkuser로 변경 + 캐시 버스팅 v=4 - Phase 4: system1에서 알림 코드 제거 (routes, controllers, models, utils) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
34
user-management/api/routes/notificationRoutes.js
Normal file
34
user-management/api/routes/notificationRoutes.js
Normal file
@@ -0,0 +1,34 @@
|
||||
// routes/notificationRoutes.js
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const notificationController = require('../controllers/notificationController');
|
||||
const { requireAuth, requireMinLevel } = require('../middleware/auth');
|
||||
|
||||
// 내부 서비스용 알림 생성 (X-Internal-Service-Key 인증, JWT 불필요)
|
||||
router.post('/internal', notificationController.createInternal);
|
||||
|
||||
// 이하 모든 라우트는 JWT 인증 필요
|
||||
router.use(requireAuth);
|
||||
|
||||
// 읽지 않은 알림 조회 (본인 알림만)
|
||||
router.get('/unread', notificationController.getUnread);
|
||||
|
||||
// 읽지 않은 알림 개수
|
||||
router.get('/unread/count', notificationController.getUnreadCount);
|
||||
|
||||
// 전체 알림 조회 (페이징)
|
||||
router.get('/', notificationController.getAll);
|
||||
|
||||
// 알림 생성 (시스템/관리자용)
|
||||
router.post('/', requireMinLevel('support_team'), notificationController.create);
|
||||
|
||||
// 모든 알림 읽음 처리 (본인 알림만)
|
||||
router.post('/read-all', notificationController.markAllAsRead);
|
||||
|
||||
// 특정 알림 읽음 처리 (본인 알림만)
|
||||
router.post('/:id/read', notificationController.markAsRead);
|
||||
|
||||
// 알림 삭제 (본인 알림만)
|
||||
router.delete('/:id', notificationController.delete);
|
||||
|
||||
module.exports = router;
|
||||
19
user-management/api/routes/pushSubscriptionRoutes.js
Normal file
19
user-management/api/routes/pushSubscriptionRoutes.js
Normal file
@@ -0,0 +1,19 @@
|
||||
// routes/pushSubscriptionRoutes.js
|
||||
const express = require('express');
|
||||
const router = express.Router();
|
||||
const pushController = require('../controllers/pushSubscriptionController');
|
||||
const { requireAuth } = require('../middleware/auth');
|
||||
|
||||
// VAPID 공개키 (인증 불필요)
|
||||
router.get('/vapid-public-key', pushController.getVapidPublicKey);
|
||||
|
||||
// 구독/해제 (인증 필요)
|
||||
router.post('/subscribe', requireAuth, pushController.subscribe);
|
||||
router.delete('/unsubscribe', requireAuth, pushController.unsubscribe);
|
||||
|
||||
// ntfy 구독 관리
|
||||
router.post('/ntfy/subscribe', requireAuth, pushController.ntfySubscribe);
|
||||
router.delete('/ntfy/unsubscribe', requireAuth, pushController.ntfyUnsubscribe);
|
||||
router.get('/ntfy/status', requireAuth, pushController.ntfyStatus);
|
||||
|
||||
module.exports = router;
|
||||
Reference in New Issue
Block a user