Skip to content

Commit 49bbac7

Browse files
committed
feat(MessageConverter): 봉사 신청 이벤트 메시지 컨버팅 처리
1 parent fad81bb commit 49bbac7

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/main/java/com/somemore/notification/converter/MessageConverter.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import com.somemore.notification.domain.Notification;
99
import com.somemore.notification.domain.NotificationSubType;
1010
import com.somemore.volunteerapply.domain.ApplyStatus;
11+
import com.somemore.volunteerapply.event.VolunteerApplyEvent;
1112
import com.somemore.volunteerapply.event.VolunteerApplyStatusChangeEvent;
1213
import lombok.RequiredArgsConstructor;
1314
import lombok.extern.slf4j.Slf4j;
@@ -30,6 +31,7 @@ public Notification from(String message) {
3031
case VOLUNTEER_REVIEW_REQUEST -> buildVolunteerReviewRequestNotification(message);
3132
case VOLUNTEER_APPLY_STATUS_CHANGE -> buildVolunteerApplyStatusChangeNotification(message);
3233
case COMMENT_ADDED -> buildCommentAddedNotification(message);
34+
case VOLUNTEER_APPLY -> buildVolunteerApplyNotification(message);
3335
};
3436
} catch (Exception e) {
3537
log.error(e.getMessage());
@@ -70,6 +72,17 @@ private Notification buildCommentAddedNotification(String message) throws JsonPr
7072
.build();
7173
}
7274

75+
private Notification buildVolunteerApplyNotification(String message) throws JsonProcessingException {
76+
VolunteerApplyEvent event = objectMapper.readValue(message, VolunteerApplyEvent.class);
77+
78+
return Notification.builder()
79+
.receiverId(event.getCenterId())
80+
.title(createVolunteerApplyNotificationTitle())
81+
.type(NotificationSubType.VOLUNTEER_APPLY)
82+
.relatedId(event.getRecruitBoardId())
83+
.build();
84+
}
85+
7386
private String createVolunteerReviewRequestNotificationTitle() {
7487
return "최근 활동하신 활동의 후기를 작성해 주세요!";
7588
}
@@ -88,4 +101,8 @@ private String createVolunteerApplyStatusChangeNotificationTitle(ApplyStatus new
88101
private String createCommentAddedNotificationTitle() {
89102
return "새로운 댓글이 작성되었습니다.";
90103
}
104+
105+
private String createVolunteerApplyNotificationTitle() {
106+
return "봉사 활동 모집에 새로운 신청이 있습니다.";
107+
}
91108
}

0 commit comments

Comments
 (0)