Skip to content

Commit

Permalink
fix: remove unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
becooq81 committed Jul 15, 2024
1 parent 707cdce commit 953b337
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ public class NotificationController {
@GetMapping("/unread")
public ResponseEntity<List<NotificationResponse>> getUnreadNotifications(@AuthenticationPrincipal Member member) {
List<Notification> notifications = notificationService.getUnreadNotificationsForMember(member.getLoginID());
if (notifications.isEmpty()) {
return ResponseEntity.status(HttpStatus.NO_CONTENT).build();
}
List<NotificationResponse> responses = notifications.stream()
.map(NotificationResponse::of)
.collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,6 @@ public List<Notification> getAllNotificationsForMember(String receiverId) {
.sorted(Comparator.comparing(Notification::getCreatedAt).reversed())
.collect(Collectors.toList());

if (!notifications.isEmpty()) {
notifications.forEach(notification -> {
if (notification != null) {
notification.memberReads();
}
});
}

Member recipient = getMemberByLoginID(receiverId);
if (recipient == null) {
throw new IllegalArgumentException("Recipient not found for the given receiverId");
Expand Down

0 comments on commit 953b337

Please sign in to comment.