feat: 실시간 알림 시스템 (Web Push + 알림 벨 + 서비스간 알림 연동)

- Phase 1: 모든 서비스 헤더에 알림 벨 UI 추가 (notification-bell.js)
- Phase 2: VAPID Web Push 구독/전송 (push-sw.js, pushSubscription API)
- Phase 3: 내부 알림 API + notifyHelper로 서비스간 알림 연동
  - tksafety: 출입 승인/반려, 안전교육 완료, 방문자 체크인
  - tkpurchase: 일용공 신청, 작업보고서 제출
  - system2-report: 신고 접수/확인/처리완료
- Phase 4: 30일 이상 알림 자동 정리 cron, Redis 캐싱
- CORS에 tkuser/tkpurchase/tksafety 서브도메인 추가
- HTML cache busting 버전 갱신

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Hyungi Ahn
2026-03-13 15:01:44 +09:00
parent 1ad82fd52c
commit 7fd646e9ba
102 changed files with 1446 additions and 94 deletions

View File

@@ -1,6 +1,7 @@
const workReportModel = require('../models/workReportModel');
const checkinModel = require('../models/checkinModel');
const ExcelJS = require('exceljs');
const notify = require('../utils/notifyHelper');
// 작업보고 목록
async function list(req, res) {
@@ -90,6 +91,18 @@ async function create(req, res) {
workers: workers || []
};
const row = await workReportModel.create(data);
// 알림: 작업 보고서 제출
notify.send({
type: 'maintenance',
title: '작업 보고서 제출',
message: `${report_date} 작업 보고서가 제출되었습니다.`,
link_url: '/workreport.html',
reference_type: 'work_reports',
reference_id: row.id || row.report_id,
created_by: data.reporter_id
});
res.status(201).json({ success: true, data: row });
} catch (err) {
console.error('WorkReport create error:', err);