88import com .somemore .notification .domain .Notification ;
99import com .somemore .notification .domain .NotificationSubType ;
1010import com .somemore .volunteerapply .domain .ApplyStatus ;
11+ import com .somemore .volunteerapply .event .VolunteerApplyEvent ;
1112import com .somemore .volunteerapply .event .VolunteerApplyStatusChangeEvent ;
1213import lombok .RequiredArgsConstructor ;
1314import 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