Skip to content

Conversation

@m-a-king
Copy link
Collaborator

@m-a-king m-a-king commented Dec 6, 2024

resolved :

📌 과제 설명

알림 읽음 처리

👩‍💻 요구 사항과 구현 내용

  1. 알림 1건 읽음 처리 (PATCH)
  2. 알림 N건 읽음 처리 (POST)
  3. 알림 읽음 처리 요청 유저와 알림 수신자 아이디 비교 검증

✅ PR 포인트 & 궁금한 점

@m-a-king m-a-king self-assigned this Dec 6, 2024
@m-a-king m-a-king linked an issue Dec 6, 2024 that may be closed by this pull request
1 task
@Secured({"ROLE_VOLUNTEER", "ROLE_CENTER"})
@Operation(summary = "알림(N개) 읽음 처리", description = "알림 N개를 읽음 처리합니다.")
@PostMapping("/read/multiple")
public ApiResponse<String> markMultipleNotifications(
Copy link
Collaborator

Choose a reason for hiding this comment

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

프론트에서는 어떤식으로 처리가 되는건가요 한개와 N개의 호출을 어떻게 하는건지 궁금합니다

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  1. 모두 읽음 처리
  2. 프론트에서 lazy한 알림 읽음 처리 요청
  3. 체크박스를 통한 알림 읽음 처리

위 3가지 모두 프론트엔드에서 이뤄지는 로직입니다.

notifications.forEach(notification ->
validateNotificationOwnership(userId, notification.getReceiverId()));

notifications.forEach(Notification::markAsRead);
Copy link
Collaborator

Choose a reason for hiding this comment

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

리스트를 업데이트 해줬을때 트랜잭션 종료시 save로 저장이 되는건지 saveAll로 되는건지 궁금합니다
혹시 전자라면 saveAll을 명시해주는것도 좋을것 같아요

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

성능 관점에서 saveAll이 좋을 것 같습니다. 더티체킹을 적극 활용하고 싶어서 의도적으로 save를 명시하지 않았습니다.


for (int i = 0; i < 10; i++) {
for (long i = 1; i <= 10; i++) {
Notification unreadNotification = Notification.builder()
Copy link
Collaborator

Choose a reason for hiding this comment

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

생성 부분을 메서드화 해주는 것도 좋을것 같습니다

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

처리하겠습니다~


// then
assertThat(notifications).isEmpty();
assertThat(notifications).hasSize(10);
Copy link
Collaborator

Choose a reason for hiding this comment

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

빈 리스트를 반환하는데 hasSize가 10인 이유가 궁금합니다

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

beforeEach 때문에 설정해두고 까먹었네요 deleteAllInBatch로 테스트 가독성 확보하겠습니다!

@m-a-king m-a-king force-pushed the feature/161-add-mark-read-notification branch from c9a866d to 1b6b5c7 Compare December 6, 2024 08:39
Copy link
Collaborator

@ayoung-dev ayoung-dev left a comment

Choose a reason for hiding this comment

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

고생하셨습니다

Copy link
Collaborator

@leebs0521 leebs0521 left a comment

Choose a reason for hiding this comment

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

고생하셨습니다.!!

@m-a-king m-a-king force-pushed the feature/161-add-mark-read-notification branch from 1b6b5c7 to 90d662b Compare December 7, 2024 11:12
@github-actions github-actions bot changed the title Feature/161 알림 읽음 처리 [BUILD FAIL] Feature/161 알림 읽음 처리 Dec 7, 2024
@github-actions github-actions bot closed this Dec 7, 2024
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

빌드에 실패했습니다.

@m-a-king m-a-king reopened this Dec 7, 2024
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

빌드에 실패했습니다.

@github-actions github-actions bot changed the title [BUILD FAIL] Feature/161 알림 읽음 처리 [BUILD FAIL] [BUILD FAIL] Feature/161 알림 읽음 처리 Dec 7, 2024
@github-actions github-actions bot closed this Dec 7, 2024
@m-a-king m-a-king reopened this Dec 7, 2024
@sonarqubecloud
Copy link

sonarqubecloud bot commented Dec 7, 2024

@m-a-king m-a-king changed the title [BUILD FAIL] [BUILD FAIL] Feature/161 알림 읽음 처리 Feature/161 알림 읽음 처리 Dec 7, 2024
@m-a-king m-a-king merged commit bed04c8 into main Dec 7, 2024
4 checks passed
@m-a-king m-a-king deleted the feature/161-add-mark-read-notification branch December 7, 2024 11:41
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.

[FEATURE] 알림 읽음 처리

5 participants