feat: [approval] 완료함 미읽음 알림 뱃지 기능 추가

- approvals 테이블에 drafter_read_at 컬럼 추가 (API 마이그레이션)
- 승인/반려/전결 완료 시 drafter_read_at = null 설정
- getBadgeCounts()에 completed_unread 카운트 추가
- 사이드메뉴 완료함에 미읽음 뱃지 표시 (주황색)
- 완료함 페이지 진입 시 일괄 읽음 처리
- 상세 페이지 열람 시 개별 읽음 처리
This commit is contained in:
김보곤
2026-03-05 11:36:58 +09:00
parent c734a23b30
commit d48a38eaf6
7 changed files with 69 additions and 0 deletions

View File

@@ -494,6 +494,34 @@ public function badgeCounts(): JsonResponse
return response()->json(['success' => true, 'data' => $counts]);
}
/**
* 완료함 읽음 처리 (일괄)
*/
public function markCompletedAsRead(): JsonResponse
{
$count = $this->service->markCompletedAsRead(auth()->id());
return response()->json([
'success' => true,
'message' => $count > 0 ? "{$count}건 읽음 처리되었습니다." : '새로운 완료 건이 없습니다.',
'data' => ['marked_count' => $count],
]);
}
/**
* 개별 문서 기안자 읽음 처리
*/
public function markReadSingle(int $id): JsonResponse
{
$approval = $this->service->getApproval($id);
if ($approval->drafter_id === auth()->id() && ! $approval->drafter_read_at) {
$approval->update(['drafter_read_at' => now()]);
}
return response()->json(['success' => true]);
}
// =========================================================================
// 첨부파일
// =========================================================================