Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -32,6 +32,7 @@ public EmailTemplate createWebhookTemplate(PushNotificationTemplate request) {
context.setVariable("taskDetailUrl", taskDetailUrl);
context.setVariable("receiverName", request.senderName());
context.setVariable("title", request.taskName());
context.setVariable("status", request.status());
break;
case PROCESSOR_CHANGED:
templateName = "processor-changed";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ public record PushNotificationTemplate(
String email,
NotificationType notificationType,
String taskName,
String status,
String senderName,
String message,
String commenterName
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
@@ -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,23 +33,16 @@ 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
email, notificationType, taskTitle, task.getTaskStatus().getDescription(), requesterNickname, message, commenterName
);

CompletableFuture<Void> saveNotification = CompletableFuture.runAsync(() -> {
commandNotificationPort.save(notification);
});

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

CompletableFuture<Void> sendEmailFuture = CompletableFuture.runAsync(() -> {
Expand All @@ -78,6 +69,7 @@ public void sendAgitNotification(NotificationType notificationType,
null,
notificationType,
task.getTitle(),
task.getTaskStatus().getDescription(),
task.getRequester().getNickname(),
message,
commenterName
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