feat(api): events 페이지네이션 메타 + 통계 3종 + notifications 정리#31
Merged
Hidden character warning
The head ref may contain hidden characters: "feature/\uc870\uc218\uadfc-events-stats-pagination"
Conversation
팀원 피드백 3종 마저 처리. #1 — notifications 'read-all' API 삭제 + 'read' 인증 보강 - frontend 가 read-all 미사용. 인증 없는 broad-update 는 보안 위험이라 엔드포인트 자체 제거. - 개별 read 핸들러는 인증(current_admin) 누락 상태였음 → 추가. #2 — GET /api/events/ 응답에 X-Total-Count 헤더 - 필터 적용된 전체 건수를 헤더로 노출 (응답 본문 형식은 그대로 list[EventResponse] 유지 — frontend 무파괴). - frontend 는 res.headers['x-total-count'] 로 읽어 총 페이지 표시 가능. - CORSMiddleware 에 expose_headers=['X-Total-Count'] 추가 (cross-origin 클라가 헤더 읽도록 보장). #4 — StatsPage 용 서버 통계 3종 추가 - GET /api/events/stats/by-type — event_type 별 카운트 - GET /api/events/stats/hourly — 시간대(0~23)별 카운트 (date_from/date_to 옵션) - GET /api/events/stats/daily?days=30 — 일자별 추이 (기본 최근 30일) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
팀원 피드백 #1, #2, #4 마저 처리.
#1 — notifications 정리
POST /api/notifications/read-all삭제 (frontend 미사용 + 인증 없는 broad-update 로 위험)PATCH /api/notifications/{id}/read에current_admin인증 추가 (이전엔 누락 상태)#2 —
GET /api/events/페이지네이션 메타 (X-Total-Count 헤더)list[EventResponse]유지 (frontend 무파괴)X-Total-Count헤더로 노출CORSMiddleware(expose_headers=['X-Total-Count'])설정해 cross-origin 클라도 헤더 접근 가능res.headers['x-total-count']로 총 페이지 표시 가능#4 — StatsPage 서버 통계 3종
GET /api/events/stats/by-type— event_type 별 카운트 (EventTypeChart)GET /api/events/stats/hourly— 시간대(0~23)별 카운트,date_from/date_to옵션 (HourlyDistributionChart)GET /api/events/stats/daily?days=30— 일자별 추이, 기본 최근 30일 (DailyTrendChart)기존
/stats,/stats/by-camera는 그대로 유지.변경
변경사항