diff --git a/src/main/java/clap/server/adapter/outbound/api/EmailTemplateBuilder.java b/src/main/java/clap/server/adapter/outbound/api/EmailTemplateBuilder.java index be20f02b..fa593d45 100644 --- a/src/main/java/clap/server/adapter/outbound/api/EmailTemplateBuilder.java +++ b/src/main/java/clap/server/adapter/outbound/api/EmailTemplateBuilder.java @@ -21,28 +21,29 @@ public EmailTemplate createWebhookTemplate(PushNotificationTemplate request) { switch (request.notificationType()) { case TASK_REQUESTED: templateName = "task-request"; - subject = "[TaskFlow 알림] 신규 작업이 요청되었습니다."; + subject = "[TaskFlow] 신규 작업"+ request.taskName()+ "요청되었습니다."; context.setVariable("taskDetailUrl", taskDetailUrl); context.setVariable("receiverName", request.senderName()); context.setVariable("title", request.taskName()); break; case STATUS_SWITCHED: templateName = "status-switched"; - subject = "[TaskFlow 알림] 작업 상태가 변경되었습니다."; + subject = "[TaskFlow] "+ request.taskName()+ " " + request.message()+ "으로 변경되었습니다."; context.setVariable("taskDetailUrl", taskDetailUrl); context.setVariable("receiverName", request.senderName()); context.setVariable("title", request.taskName()); + context.setVariable("status", request.message()); break; case PROCESSOR_CHANGED: templateName = "processor-changed"; - subject = "[TaskFlow 알림] 작업 담당자가 변경되었습니다."; + subject = "[TaskFlow] "+ request.taskName()+ "담당자" + request.message() + " 변경되었습니다."; context.setVariable("taskDetailUrl", taskDetailUrl); context.setVariable("processorName", request.message()); context.setVariable("title", request.taskName()); break; case PROCESSOR_ASSIGNED: templateName = "processor-assigned"; - subject = "[TaskFlow 알림] 작업 담당자가 지정되었습니다."; + subject = "[TaskFlow] "+ request.taskName()+ "담당자" + request.message() + " 지정되었습니다.."; context.setVariable("taskDetailUrl", taskDetailUrl); context.setVariable("processorName", request.message()); context.setVariable("title", request.taskName()); diff --git a/src/main/java/clap/server/adapter/outbound/infrastructure/sse/SendSseService.java b/src/main/java/clap/server/adapter/outbound/infrastructure/sse/SseEventEmitter.java similarity index 95% rename from src/main/java/clap/server/adapter/outbound/infrastructure/sse/SendSseService.java rename to src/main/java/clap/server/adapter/outbound/infrastructure/sse/SseEventEmitter.java index 5785653e..8a0c0d75 100644 --- a/src/main/java/clap/server/adapter/outbound/infrastructure/sse/SendSseService.java +++ b/src/main/java/clap/server/adapter/outbound/infrastructure/sse/SseEventEmitter.java @@ -11,7 +11,7 @@ @InfrastructureAdapter @RequiredArgsConstructor -public class SendSseService implements SendSsePort { +public class SseEventEmitter implements SendSsePort { private final EmitterRepository emitterRepository; diff --git a/src/main/java/clap/server/application/service/task/UpdateTaskService.java b/src/main/java/clap/server/application/service/task/UpdateTaskService.java index 7190ecc2..2d978eb5 100644 --- a/src/main/java/clap/server/application/service/task/UpdateTaskService.java +++ b/src/main/java/clap/server/application/service/task/UpdateTaskService.java @@ -83,7 +83,7 @@ public void updateTaskStatus(Long memberId, Long taskId, TaskStatus taskStatus) Task updateTask = taskService.upsert(task); TaskHistory taskHistory = TaskHistory.createTaskHistory(TaskHistoryType.STATUS_SWITCHED, task, taskStatus.getDescription(), null,null); commandTaskHistoryPort.save(taskHistory); - publishNotification(updateTask, NotificationType.STATUS_SWITCHED, String.valueOf(updateTask.getTaskStatus())); + publishNotification(updateTask, NotificationType.STATUS_SWITCHED, updateTask.getTaskStatus().getDescription()); } } diff --git a/src/main/java/clap/server/application/service/webhook/SendNotificationService.java b/src/main/java/clap/server/application/service/webhook/SendNotificationService.java index e28203fe..aebed83e 100644 --- a/src/main/java/clap/server/application/service/webhook/SendNotificationService.java +++ b/src/main/java/clap/server/application/service/webhook/SendNotificationService.java @@ -1,10 +1,8 @@ package clap.server.application.service.webhook; -import clap.server.adapter.inbound.web.dto.notification.request.SseRequest; import clap.server.adapter.outbound.api.dto.PushNotificationTemplate; import clap.server.adapter.outbound.persistense.entity.notification.constant.NotificationType; import clap.server.application.port.outbound.notification.CommandNotificationPort; -import clap.server.application.port.outbound.webhook.SendSsePort; import clap.server.common.annotation.architecture.ApplicationService; import clap.server.domain.model.member.Member; import clap.server.domain.model.notification.Notification; @@ -20,7 +18,7 @@ @RequiredArgsConstructor public class SendNotificationService { - private final SendSsePort sendSsePort; + private final SendSseService sendSseService; private final SendAgitService sendAgitService; private final SendWebhookEmailService sendWebhookEmailService; private final SendKaKaoWorkService sendKaKaoWorkService; @@ -35,13 +33,6 @@ public void sendPushNotification(Member receiver, NotificationType notificationT Notification notification = createTaskNotification(task, receiver, notificationType, message, taskTitle); - SseRequest sseRequest = new SseRequest( - taskTitle, - notificationType, - receiver.getMemberId(), - message - ); - PushNotificationTemplate pushNotificationTemplate = new PushNotificationTemplate( email, notificationType, taskTitle, requesterNickname, message, commenterName ); @@ -51,7 +42,7 @@ public void sendPushNotification(Member receiver, NotificationType notificationT }); CompletableFuture sendSseFuture = CompletableFuture.runAsync(() -> { - sendSsePort.send(sseRequest); + sendSseService.send(receiver, notificationType, task, message); }); CompletableFuture sendEmailFuture = CompletableFuture.runAsync(() -> { diff --git a/src/main/java/clap/server/application/service/webhook/SendSseService.java b/src/main/java/clap/server/application/service/webhook/SendSseService.java new file mode 100644 index 00000000..7d918784 --- /dev/null +++ b/src/main/java/clap/server/application/service/webhook/SendSseService.java @@ -0,0 +1,26 @@ +package clap.server.application.service.webhook; + +import clap.server.adapter.inbound.web.dto.notification.request.SseRequest; +import clap.server.adapter.outbound.persistense.entity.notification.constant.NotificationType; +import clap.server.application.port.outbound.webhook.SendSsePort; +import clap.server.domain.model.member.Member; +import clap.server.domain.model.task.Task; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +@Service +@RequiredArgsConstructor +public class SendSseService { + private final SendSsePort sendSsePort; + + public void send(Member receiver, NotificationType notificationType, + Task task, String message) { + SseRequest sseRequest = new SseRequest( + task.getTitle(), + notificationType, + receiver.getMemberId(), + message + ); + sendSsePort.send(sseRequest); + } +} \ No newline at end of file diff --git a/src/main/resources/templates/comment.html b/src/main/resources/templates/comment.html index bce6add4..e059bb4b 100644 --- a/src/main/resources/templates/comment.html +++ b/src/main/resources/templates/comment.html @@ -22,7 +22,7 @@ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); } .header { - background-color: #0052cc; + background-color: #7879EB; color: #ffffff; padding: 15px; text-align: center; @@ -39,7 +39,7 @@ margin: 20px 0; } .cta-button a { - background-color: #0052cc; + background-color: #7879EB; color: #ffffff; text-decoration: none; padding: 10px 20px; @@ -47,7 +47,7 @@ font-weight: bold; } .cta-button a:hover { - background-color: #0041a7; + background-color: #18181B; } .footer { text-align: center; diff --git a/src/main/resources/templates/invitation.html b/src/main/resources/templates/invitation.html index 89090b4d..1c132809 100644 --- a/src/main/resources/templates/invitation.html +++ b/src/main/resources/templates/invitation.html @@ -22,7 +22,7 @@ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); } .header { - background-color: #0052cc; + background-color: #7879EB; color: #ffffff; padding: 15px; text-align: center; @@ -39,7 +39,7 @@ margin: 20px 0; } .cta-button a { - background-color: #0052cc; + background-color: #7879EB; color: #ffffff; text-decoration: none; padding: 10px 20px; @@ -47,7 +47,7 @@ font-weight: bold; } .cta-button a:hover { - background-color: #0041a7; + background-color: #18181B; } .footer { text-align: center; diff --git a/src/main/resources/templates/processor-assign.html b/src/main/resources/templates/processor-assigned.html similarity index 93% rename from src/main/resources/templates/processor-assign.html rename to src/main/resources/templates/processor-assigned.html index 9a326e65..9e8153d8 100644 --- a/src/main/resources/templates/processor-assign.html +++ b/src/main/resources/templates/processor-assigned.html @@ -22,7 +22,7 @@ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); } .header { - background-color: #0052cc; + background-color: #7879EB; color: #ffffff; padding: 15px; text-align: center; @@ -39,7 +39,7 @@ margin: 20px 0; } .cta-button a { - background-color: #0052cc; + background-color: #7879EB; color: #ffffff; text-decoration: none; padding: 10px 20px; @@ -47,7 +47,7 @@ font-weight: bold; } .cta-button a:hover { - background-color: #0041a7; + background-color: #18181B; } .footer { text-align: center; @@ -66,7 +66,7 @@