Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

@InfrastructureAdapter
@RequiredArgsConstructor
public class SendSseService implements SendSsePort {
public class SseEventEmitter implements SendSsePort {

private final EmitterRepository emitterRepository;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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;
Expand All @@ -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
);
Expand All @@ -51,7 +42,7 @@ public void sendPushNotification(Member receiver, NotificationType notificationT
});

CompletableFuture<Void> sendSseFuture = CompletableFuture.runAsync(() -> {
sendSsePort.send(sseRequest);
sendSseService.send(receiver, notificationType, task, message);
});

CompletableFuture<Void> sendEmailFuture = CompletableFuture.runAsync(() -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}
6 changes: 3 additions & 3 deletions src/main/resources/templates/comment.html
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -39,15 +39,15 @@
margin: 20px 0;
}
.cta-button a {
background-color: #0052cc;
background-color: #7879EB;
color: #ffffff;
text-decoration: none;
padding: 10px 20px;
border-radius: 5px;
font-weight: bold;
}
.cta-button a:hover {
background-color: #0041a7;
background-color: #18181B;
}
.footer {
text-align: center;
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/templates/invitation.html
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -39,15 +39,15 @@
margin: 20px 0;
}
.cta-button a {
background-color: #0052cc;
background-color: #7879EB;
color: #ffffff;
text-decoration: none;
padding: 10px 20px;
border-radius: 5px;
font-weight: bold;
}
.cta-button a:hover {
background-color: #0041a7;
background-color: #18181B;
}
.footer {
text-align: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -39,15 +39,15 @@
margin: 20px 0;
}
.cta-button a {
background-color: #0052cc;
background-color: #7879EB;
color: #ffffff;
text-decoration: none;
padding: 10px 20px;
border-radius: 5px;
font-weight: bold;
}
.cta-button a:hover {
background-color: #0041a7;
background-color: #18181B;
}
.footer {
text-align: center;
Expand All @@ -66,7 +66,7 @@
<body>
<div class="email-container">
<div class="header">
TaskFlow 알림 서비스
TaskFlow 업데이트 알림
</div>
<div class="content">
<p>"<strong th:text="${title}"></strong>" 작업의 담당자가 할당되었습니다.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -39,15 +39,15 @@
margin: 20px 0;
}
.cta-button a {
background-color: #0052cc;
background-color: #7879EB;
color: #ffffff;
text-decoration: none;
padding: 10px 20px;
border-radius: 5px;
font-weight: bold;
}
.cta-button a:hover {
background-color: #0041a7;
background-color: #18181B;
}
.footer {
text-align: center;
Expand All @@ -66,7 +66,7 @@
<body>
<div class="email-container">
<div class="header">
TaskFlow 알림 서비스
TaskFlow 업데이트 알림
</div>
<div class="content">
<p><strong th:text="${title}"></strong> 작업의 담당자가 변경되었습니다.</p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -39,15 +39,15 @@
margin: 20px 0;
}
.cta-button a {
background-color: #0052cc;
background-color: #7879EB;
color: #ffffff;
text-decoration: none;
padding: 10px 20px;
border-radius: 5px;
font-weight: bold;
}
.cta-button a:hover {
background-color: #0041a7;
background-color: #18181B;
}
.footer {
text-align: center;
Expand All @@ -66,13 +66,10 @@
<body>
<div class="email-container">
<div class="header">
TaskFlow 알림 서비스
TaskFlow 업데이트 알림
</div>
<div class="content">
<p><strong th:text="${title}"></strong> 작업 상태가 변경되었습니다.</p>
<ul>
<li>작업 상태: <span th:text="${status}"></span></li>
</ul>
<p><strong th:text="${title}"></strong> 작업 상태가 <strong><span th:text="${status}"></span></strong> 변경되었습니다.</p>
<div class="cta-button">
<a href="https://example.com/task/1" target="_blank" th:href="${taskDetailUrl}">확인하기</a>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/templates/task-request.html
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -39,15 +39,15 @@
margin: 20px 0;
}
.cta-button a {
background-color: #0052cc;
background-color: #7879EB;
color: #ffffff;
text-decoration: none;
padding: 10px 20px;
border-radius: 5px;
font-weight: bold;
}
.cta-button a:hover {
background-color: #0041a7;
background-color: #18181B;
}
.footer {
text-align: center;
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/templates/verification.html
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -39,15 +39,15 @@
margin: 20px 0;
}
.cta-button a {
background-color: #0052cc;
background-color: #7879EB;
color: #ffffff;
text-decoration: none;
padding: 10px 20px;
border-radius: 5px;
font-weight: bold;
}
.cta-button a:hover {
background-color: #0041a7;
background-color: #18181B;
}
.footer {
text-align: center;
Expand Down