33import clap .server .adapter .inbound .web .dto .notification .request .SseRequest ;
44import clap .server .adapter .outbound .api .dto .PushNotificationTemplate ;
55import clap .server .adapter .outbound .persistense .entity .notification .constant .NotificationType ;
6+ import clap .server .application .port .inbound .domain .TaskService ;
67import clap .server .application .port .outbound .notification .CommandNotificationPort ;
8+ import clap .server .application .port .outbound .webhook .SendSsePort ;
79import clap .server .common .annotation .architecture .ApplicationService ;
810import clap .server .domain .model .member .Member ;
911import clap .server .domain .model .notification .Notification ;
1820@ RequiredArgsConstructor
1921public class SendNotificationService {
2022
21- private final SendSseService sendSseService ;
23+ private final SendSsePort sendSsePort ;
2224 private final SendAgitService sendAgitService ;
2325 private final SendWebhookEmailService sendWebhookEmailService ;
2426 private final SendKaKaoWorkService sendKaKaoWorkService ;
2527 private final CommandNotificationPort commandNotificationPort ;
28+ private final TaskService taskService ;
2629
2730 @ Async ("notificationExecutor" )
2831 public void sendPushNotification (Member receiver , NotificationType notificationType ,
@@ -49,18 +52,18 @@ public void sendPushNotification(Member receiver, NotificationType notificationT
4952 });
5053
5154 CompletableFuture <Void > sendSseFuture = CompletableFuture .runAsync (() -> {
52- sendSseService .send (sseRequest );
55+ sendSsePort .send (sseRequest );
5356 });
5457
5558 CompletableFuture <Void > sendEmailFuture = CompletableFuture .runAsync (() -> {
5659 if (receiver .getEmailNotificationEnabled ()) {
57- sendWebhookEmailService .sendEmail (pushNotificationTemplate );
60+ sendWebhookEmailService .send (pushNotificationTemplate );
5861 }
5962 });
6063
6164 CompletableFuture <Void > sendKakaoWorkFuture = CompletableFuture .runAsync (() -> {
6265 if (receiver .getKakaoworkNotificationEnabled ()) {
63- sendKaKaoWorkService .sendKaKaoWork (pushNotificationTemplate );
66+ sendKaKaoWorkService .send (pushNotificationTemplate );
6467 }
6568 });
6669
@@ -81,6 +84,11 @@ public void sendAgitNotification(NotificationType notificationType,
8184 commenterName
8285 );
8386
84- sendAgitService .sendAgit (pushNotificationTemplate , task );
87+ if (notificationType .equals (NotificationType .TASK_REQUESTED )){
88+ Long agitPostId = sendAgitService .sendAgit (pushNotificationTemplate , task );
89+
90+ task .updateAgitPostId (agitPostId );
91+ taskService .upsert (task );
92+ }
8593 }
8694}
0 commit comments