Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api: ✨ 미확인 푸시 알림 읽음 처리 API #136

Merged
merged 14 commits into from
Jul 18, 2024

Conversation

psychology50
Copy link
Member

작업 이유

  • 사용자가 수신한 알림들을 읽음 처리할 수 있는 API가 필요

작업 사항

  • url : PATCH /v2/notifications
  • body : 읽음 처리할 알림 pk 리스트
    • 자원 접근 검사 : 사용자는 pk 리스트 전체에 대한 접근 권한이 있어야 하며, 하나라도 읽음 처리된 알림이 없어야 한다.
    • 요청 유효성 검사 : pk 리스트는 null 혹은 empty를 허용하지 않습니다.

리뷰어가 중점적으로 확인해야 하는 부분

  • 접근 검사 할 때, 읽음 처리된 알림을 필터링 하는 이유는 readAt이 잘못된 값으로 초기화될 우려가 있기 때문입니다.
    • 예를 들어, pk에 대한 fk가 사용자에게 존재하는 지만 검사하면, 이미 읽음 처리된 알림을 섞어보내면 readAt이 갱신됩니다.
    • pros. 데이터의 정확성을 유지할 수 있음.
    • cons. 현재 방식으로는 불순한 데이터가 같이 요청이 전달된 건지, 읽음 처리된 요청이 함께 전달된 건지 Client에서 명확하게 구분할 수 없음.
  • 읽음 처리할 알림이 하나라면, 단일 읽음 처리 API를 따로 구현하여 내부적으로 핸들링하도록 할 수 있겠지만, 어차피 IN 절을 써도 index를 탈 것이므로 굳이 안 했습니다. (그렇게까지 높은 성능적 효과를 얻긴 힘들 거라 생각)

발견한 이슈

  • 없음

@psychology50 psychology50 added the enhancement New feature or request label Jul 18, 2024
@psychology50 psychology50 self-assigned this Jul 18, 2024
@psychology50 psychology50 merged commit 4f51e7b into dev Jul 18, 2024
2 checks passed
@psychology50 psychology50 deleted the feat/PW-432-patch-notifications branch July 18, 2024 04:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant