Skip to content

feat. 알림 삭제 API (단건·전체) #200

Description

@howudong

FE 요청서: https://github.com/ditto-develop/ditto-fe/wiki/BE-Request-Delete-And-Profile-Edit (1번)

배경

알림 API에 삭제가 없다. 조회·읽음 처리만 있어서 FE가 localStorage(ditto.hiddenNotificationIds)로 기기 로컬 숨김을 붙여 우회 배포한 상태다. 다른 기기·재설치에서는 다시 보인다.

요청 스펙

DELETE /api/v1/notifications/{id}
  → 내 알림 1건 삭제. 멱등. 내 알림이 아니면 404

DELETE /api/v1/notifications?category=MATCHING|CHAT|SYSTEM
  → 내 알림 전체 삭제 (category 생략 시 전부)

응답은 read-all과 같은 모양: { deletedCount: number }

구현 방향

하드 삭제로 간다. 알림 테이블의 기존 삭제 경로가 전부 단일 DELETE다.

  • deleteUnread — 새 메시지 알림 접기
  • deleteAllByMemberId — 탈퇴 완전 삭제
  • deleteCreatedBefore — 30일 보관 경과분 정리(NotificationPurgeScheduler)

알림 본문에 닉네임·메시지 미리보기가 들어 있어 보이지 않는 개인정보를 오래 들고 있지 않는다는 게 기존 정책이고, 소프트 삭제는 이 정책과 겹친다. 컬럼 추가 마이그레이션 없이, 조회 3경로(커서 목록·unread-count·markAllRead)도 손대지 않는다.

작업 범위

  • NotificationRepositoryCustom에 삭제 쿼리 추가 (단건은 deleteByIdAndMemberId 파생으로 충분한지 확인)
  • 서비스·컨트롤러 + 응답 DTO
  • REST Docs 문서화 테스트
  • 마이그레이션 없음

확인 사항

  • 삭제 후 목록·unread-count에서 함께 빠지는지 (하드 삭제라 자동으로 맞지만 테스트로 고정)
  • 남의 알림 id를 찍었을 때 404

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions