Skip to content

Conversation

@habbiness
Copy link
Contributor

@habbiness habbiness commented Nov 19, 2024

Pull requests

작업한 내용

  • 알림 메시지를 수정하였습니다.
  • 알림을 제공하는 자의 정보가 필요하여 db에 추가하였습니다.
  • 읽음 처리 기능을 추가하였습니다.

PR Point

  • 알림을 추가하는 로직이 빠진 부분은 없는지 확인해주세요
  • 알림 개수를 읽지 않은 알림의 개수로 수정하였습니다.
  • user 객체의 정보를 가져와야 하므로, user로 매핑하였습니다

📸 스크린샷

사진 설명
image 알림 추가
image 알림 개별 읽기
image 알림 개수 줄어듦
image 알림 조회

논의 사항 (선택)

  • 논의할 사항이 있다면 적어주세요.

closed #355

@habbiness habbiness self-assigned this Nov 19, 2024
@habbiness habbiness linked an issue Nov 19, 2024 that may be closed by this pull request
4 tasks
Copy link
Contributor

@ckwogus37 ckwogus37 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드 확인했습니다!
알림 기능이 확장되어서 서비스가 더욱 풍부해진것 같아 좋네요!

List<Notification> unreadNotifications = notificationRepository.findUnreadNotificationsByUserId(userId);
unreadNotifications.forEach(Notification::markAsRead);
notificationRepository.saveAll(unreadNotifications);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

읽지 않은 모든 알람들의 is_read값을 true로 바꾸시려는 의도라면,
현재(조회 -> 수정 -> 저장) 방법도 좋지만, Update 쿼리(수정)를 사용하는 방법도 추천드려봅니다!

제가 루틴 완료를 매일 초기화하는 로직과 유사한 것 같아서 생각났습니다!

Update notifications n SET n.isRead = TRUE WHERE n.userId = :userId AND n.isRead IS FALSE

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

오 추천감사합니당!

Copy link
Contributor

@jeeehdev jeeehdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드 확인했습니다! 고생하셨습니당!

@habbiness habbiness merged commit 04ec7b5 into main Nov 19, 2024
1 check passed
@habbiness habbiness deleted the refactor/355-refactor-notification-api branch November 19, 2024 10:35
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.

[Refactor] Refactor Notification API

4 participants