Skip to content

feat: 알림 API 개선 및 OpenAPI 문서 수정 - #56

Merged
wkdalswn11 merged 1 commit into
devfrom
feature/notification
Jul 29, 2026
Merged

wkdalswn11 merged 1 commit into
devfrom
feature/notification

Conversation

@wkdalswn11

@wkdalswn11 wkdalswn11 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

📌 작업 내용

알림 API 코드리뷰 반영 및 기능 개선을 진행했습니다.

✅ 변경 사항

  • 알림 목록 조회 API에 페이지네이션(page, limit) 추가
  • 알림 생성 시 expiresAt을 필수값으로 변경하여 의도치 않은 무기한 알림 생성 방지
  • 알림 API OpenAPI 문서 및 설명 수정

🧪 테스트

  • 서버 실행 확인
  • API 동작 확인
  • DB 연동 확인
  • 로그 확인
  • 기타:

테스트 방법

  1. 서버 실행 후 Swagger에서 알림 조회 API 호출
  2. GET /api/notifications?page=1&limit=5 요청으로 페이지네이션 동작 확인
  3. expiresAt 필수화에 따른 타입 및 API 정상 동작 확인

📷 스크린샷 (선택)

🔥 체크리스트

  • 코드 컨벤션을 준수했습니다.
  • 불필요한 console.log를 제거했습니다.
  • ESLint 오류가 없습니다.
  • 변경 사항을 직접 테스트했습니다.
  • 관련 문서를 업데이트했습니다. (필요 시)

🙏 To Reviewer

  • 코드리뷰에서 주신 페이지네이션 및 expiresAt 관련 내용을 반영했습니다.
  • 알림 생성은 각 도메인(Service)에서 notificationService.createNotification()을 호출하도록 연동이 필요한 상태이며, 담당자들에게 연동 방법을 안내했습니다.

Summary by CodeRabbit

  • 새 기능

    • 알림 목록 조회에 페이지 번호와 표시 개수 설정을 지원합니다.
    • 알림 목록 응답에 전체 개수와 페이지네이션 정보가 포함됩니다.
    • 페이지 및 표시 개수 입력값을 자동 검증하며, 기본값과 허용 범위를 적용합니다.
    • 알림은 최신 생성 순으로 표시되며, 유효 기간이 지난 알림은 제외됩니다.
  • 문서

    • 알림 목록 API의 페이지네이션 방식, 기본값, 정렬 기준 및 응답 정보를 명확히 안내합니다.

@wkdalswn11 wkdalswn11 self-assigned this Jul 29, 2026
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: e3eac860-216b-4f94-b652-94f4b6bcc356

📥 Commits

Reviewing files that changed from the base of the PR and between dbbd9e7 and 5c8b6e8.

📒 Files selected for processing (7)
  • src/modules/notification/notification-sse.controller.ts
  • src/modules/notification/notification.controller.ts
  • src/modules/notification/notification.docs.ts
  • src/modules/notification/notification.repository.ts
  • src/modules/notification/notification.route.ts
  • src/modules/notification/notification.type.ts
  • src/modules/notification/notification.validator.ts

📝 Walkthrough

Walkthrough

알림 목록 API에 pagelimit 검증 및 페이지네이션 응답이 추가되었습니다. 저장소는 목록과 전체 개수를 함께 조회하며, 알림 만료일 계약과 SSE 구독 반환 타입 및 관련 문서가 갱신되었습니다.

Changes

알림 API 페이지네이션

Layer / File(s) Summary
알림 계약 및 쿼리 검증
src/modules/notification/notification.type.ts, src/modules/notification/notification.validator.ts
expiresAt을 필수 필드로 변경하고, 페이지네이션 응답 인터페이스와 page/limit 검증 스키마를 추가했습니다.
페이지네이션 조회 흐름
src/modules/notification/notification.route.ts, src/modules/notification/notification.controller.ts, src/modules/notification/notification.repository.ts, src/modules/notification/notification.docs.ts
알림 목록 요청을 검증된 쿼리로 처리하고, 저장소가 skip/take와 전체 개수를 사용해 페이지네이션 결과를 반환하도록 변경했습니다. 관련 라우트 주석과 OpenAPI 설명도 갱신했습니다.
알림 생성 및 SSE 연결 계약
src/modules/notification/notification.repository.ts, src/modules/notification/notification-sse.controller.ts
알림 생성 시 expiresAt을 그대로 저장하도록 변경하고, SSE subscribe 반환 타입을 Promise<void>로 변경했습니다.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant notificationRouter
  participant notificationController
  participant notificationService
  participant notificationRepository
  participant Database
  Client->>notificationRouter: GET /?page&limit
  notificationRouter->>notificationRouter: Validate query
  notificationRouter->>notificationController: Forward validated query
  notificationController->>notificationService: Request paginated notifications
  notificationService->>notificationRepository: Query notifications and total count
  notificationRepository->>Database: findMany and count
  Database-->>notificationRepository: Results
  notificationRepository-->>notificationController: NotificationListResponse
Loading

Possibly related PRs

Suggested labels: ✨ feat

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/notification

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant