feat(tkuser): 알림 수신자 탭에 ntfy 구독 관리 추가
- notificationRecipientModel에 ntfy CRUD 메서드 추가 (같은 DB 직접 쿼리) - ntfy 라우트 3개 추가 (GET/POST/DELETE, /:type 위에 배치) - 알림 수신자 탭 상단에 ntfy 구독 관리 카드 렌더링 - ntfy 추가 모달에 앱 설정 안내 문구 포함 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -83,6 +83,52 @@ const notificationRecipientController = {
|
||||
}
|
||||
},
|
||||
|
||||
// === ntfy 구독 관리 ===
|
||||
|
||||
// ntfy 구독자 목록
|
||||
getNtfySubscribers: async (req, res) => {
|
||||
try {
|
||||
const subscribers = await notificationRecipientModel.getNtfySubscribers();
|
||||
res.json({ success: true, data: subscribers });
|
||||
} catch (error) {
|
||||
console.error('ntfy 구독자 조회 오류:', error);
|
||||
res.status(500).json({ success: false, error: 'ntfy 구독자 조회 실패' });
|
||||
}
|
||||
},
|
||||
|
||||
// ntfy 구독 등록 (관리자)
|
||||
addNtfySubscription: async (req, res) => {
|
||||
try {
|
||||
const { userId } = req.params;
|
||||
if (!userId) {
|
||||
return res.status(400).json({ success: false, error: '사용자 ID가 필요합니다.' });
|
||||
}
|
||||
if (!await checkNrPermission(req.user)) {
|
||||
return res.status(403).json({ success: false, error: '알림 수신자 관리 권한이 없습니다.' });
|
||||
}
|
||||
await notificationRecipientModel.addNtfySubscription(Number(userId));
|
||||
res.json({ success: true, message: 'ntfy 구독이 등록되었습니다.' });
|
||||
} catch (error) {
|
||||
console.error('ntfy 구독 등록 오류:', error);
|
||||
res.status(500).json({ success: false, error: 'ntfy 구독 등록 실패' });
|
||||
}
|
||||
},
|
||||
|
||||
// ntfy 구독 해제 (관리자)
|
||||
removeNtfySubscription: async (req, res) => {
|
||||
try {
|
||||
const { userId } = req.params;
|
||||
if (!await checkNrPermission(req.user)) {
|
||||
return res.status(403).json({ success: false, error: '알림 수신자 관리 권한이 없습니다.' });
|
||||
}
|
||||
await notificationRecipientModel.removeNtfySubscription(Number(userId));
|
||||
res.json({ success: true, message: 'ntfy 구독이 해제되었습니다.' });
|
||||
} catch (error) {
|
||||
console.error('ntfy 구독 해제 오류:', error);
|
||||
res.status(500).json({ success: false, error: 'ntfy 구독 해제 실패' });
|
||||
}
|
||||
},
|
||||
|
||||
// 유형별 수신자 일괄 설정
|
||||
setRecipients: async (req, res) => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user