Skip to content

Commit d6d9565

Browse files
committed
feat(VolunteerReviewRequestEvent): 봉사 후기 요청 이벤트 발행 추가
- SettleVolunteerApplyFacadeService 에서 이벤트 발생. - subType 명명 수정.
1 parent 3665c78 commit d6d9565

File tree

4 files changed

+22
-3
lines changed

4 files changed

+22
-3
lines changed

src/main/java/com/somemore/facade/volunteerapply/SettleVolunteerApplyFacadeService.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
import static com.somemore.global.exception.ExceptionMessage.UNAUTHORIZED_RECRUIT_BOARD;
55
import static com.somemore.global.exception.ExceptionMessage.VOLUNTEER_APPLY_LIST_MISMATCH;
66

7+
import com.somemore.facade.event.VolunteerReviewRequestEvent;
8+
import com.somemore.global.common.event.ServerEventPublisher;
9+
import com.somemore.global.common.event.ServerEventType;
710
import com.somemore.global.exception.BadRequestException;
11+
import com.somemore.notification.domain.NotificationSubType;
812
import com.somemore.recruitboard.domain.RecruitBoard;
913
import com.somemore.recruitboard.usecase.query.RecruitBoardQueryUseCase;
1014
import com.somemore.volunteer.usecase.UpdateVolunteerUseCase;
@@ -25,6 +29,7 @@ public class SettleVolunteerApplyFacadeService implements SettleVolunteerApplyFa
2529
private final VolunteerApplyQueryUseCase volunteerApplyQueryUseCase;
2630
private final RecruitBoardQueryUseCase recruitBoardQueryUseCase;
2731
private final UpdateVolunteerUseCase updateVolunteerUseCase;
32+
private final ServerEventPublisher serverEventPublisher;
2833

2934
@Override
3035
public void settleVolunteerApplies(VolunteerApplySettleRequestDto dto, UUID centerId) {
@@ -41,6 +46,7 @@ public void settleVolunteerApplies(VolunteerApplySettleRequestDto dto, UUID cent
4146
applies.forEach(apply -> {
4247
apply.changeAttended(true);
4348
updateVolunteerUseCase.updateVolunteerStats(apply.getVolunteerId(), hours);
49+
publishVolunteerReviewRequestEvent(apply, recruitBoard);
4450
});
4551

4652
}
@@ -68,4 +74,17 @@ private void validateRecruitBoardConsistency(List<VolunteerApply> applies,
6874
throw new BadRequestException(RECRUIT_BOARD_ID_MISMATCH);
6975
}
7076
}
77+
78+
private void publishVolunteerReviewRequestEvent(VolunteerApply apply, RecruitBoard recruitBoard) {
79+
VolunteerReviewRequestEvent event = VolunteerReviewRequestEvent.builder()
80+
.type(ServerEventType.NOTIFICATION)
81+
.subType(NotificationSubType.VOLUNTEER_REVIEW_REQUEST)
82+
.volunteerId(apply.getVolunteerId())
83+
.volunteerApplyId(apply.getId())
84+
.centerId(recruitBoard.getCenterId())
85+
.recruitBoardId(recruitBoard.getId())
86+
.build();
87+
88+
serverEventPublisher.publish(event);
89+
}
7190
}

src/main/java/com/somemore/notification/domain/NotificationSubType.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
@RequiredArgsConstructor
88
public enum NotificationSubType {
99
NOTE_BLAH_BLAH("쪽지"),
10-
REVIEW_BLAH_BLAH("후기 요청"),
10+
VOLUNTEER_REVIEW_REQUEST("봉사 후기 요청"),
1111
VOLUNTEER_APPLY_STATUS_CHANGE("신청 상태 변경")
1212
;
1313

src/test/java/com/somemore/notification/service/NotificationCommandServiceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ private Notification createNotification(UUID receiverId) {
126126
return Notification.builder()
127127
.receiverId(receiverId)
128128
.title("Unread")
129-
.type(NotificationSubType.REVIEW_BLAH_BLAH)
129+
.type(NotificationSubType.VOLUNTEER_REVIEW_REQUEST)
130130
.relatedId(1L)
131131
.build();
132132
}

src/test/java/com/somemore/notification/service/NotificationQueryServiceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void getReadNotifications() {
5555

5656
Notification readNotification = Notification.builder()
5757
.title("Read Notification")
58-
.type(NotificationSubType.REVIEW_BLAH_BLAH)
58+
.type(NotificationSubType.VOLUNTEER_REVIEW_REQUEST)
5959
.receiverId(receiverId)
6060
.relatedId(2L)
6161
.build();

0 commit comments

Comments
 (0)