From c3c2e71a1164a7e487988694c28f2c9dfce1e541 Mon Sep 17 00:00:00 2001 From: andrew Date: Fri, 7 Feb 2025 14:13:24 +0900 Subject: [PATCH 1/2] =?UTF-8?q?CLAP-315=20Fix=20:=20Redirect=20URL=20?= =?UTF-8?q?=ED=99=98=EA=B2=BD=EB=B3=80=EC=88=98=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../outbound/api/EmailTemplateBuilder.java | 6 +++++- .../service/webhook/SendNotificationService.java | 16 +++++++++++++--- src/main/resources/notifications.yml | 12 ++++++++++-- 3 files changed, 28 insertions(+), 6 deletions(-) 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 f235f3af..702a47fb 100644 --- a/src/main/java/clap/server/adapter/outbound/api/EmailTemplateBuilder.java +++ b/src/main/java/clap/server/adapter/outbound/api/EmailTemplateBuilder.java @@ -3,6 +3,7 @@ import clap.server.adapter.outbound.api.dto.EmailTemplate; import clap.server.adapter.outbound.api.dto.PushNotificationTemplate; import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; import org.thymeleaf.context.Context; import org.thymeleaf.spring6.SpringTemplateEngine; @@ -13,6 +14,9 @@ public class EmailTemplateBuilder { private final SpringTemplateEngine templateEngine; + @Value("${redirect.url.login}") + private String REDIRECT_URL_LOGIN; + public EmailTemplate createWebhookTemplate(PushNotificationTemplate request, String taskDetailUrl) { Context context = new Context(); String templateName = ""; @@ -66,7 +70,7 @@ public EmailTemplate createInvitationTemplate(String receiver, String receiverNa String templateName = "invitation"; String subject = "[TaskFlow 초대] 회원가입을 환영합니다."; context.setVariable("userNickname", userNickname); - context.setVariable("invitationLink", "http://localhost:5173/login"); + context.setVariable("invitationLink", REDIRECT_URL_LOGIN); context.setVariable("initialPassword", initialPassword); context.setVariable("receiverName", receiverName); String body = templateEngine.process(templateName, context); 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 473a37b5..49ddbef1 100644 --- a/src/main/java/clap/server/application/service/webhook/SendNotificationService.java +++ b/src/main/java/clap/server/application/service/webhook/SendNotificationService.java @@ -8,6 +8,7 @@ import clap.server.domain.model.notification.Notification; import clap.server.domain.model.task.Task; import lombok.RequiredArgsConstructor; +import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Async; import java.util.concurrent.CompletableFuture; @@ -18,6 +19,15 @@ @RequiredArgsConstructor public class SendNotificationService { + @Value("${redirect.url.user}") + private String REDIRECT_URL_USER; + + @Value("${redirect.url.task.request}") + private String REDIRECT_URL_TASK_REQUEST; + + @Value("${redirect.url.manger}") + private String REDIRECT_URL_MANAGER; + //private final SendSseService sendSseService; private final SendAgitService sendAgitService; private final SendWebhookEmailService sendWebhookEmailService; @@ -92,13 +102,13 @@ public void sendAgitNotification(NotificationType notificationType, } private String extractTaskUrl(NotificationType notificationType, Task task, Boolean isManager) { - String taskDetailUrl = "http://localhost:5173/my-request?taskId=" + task.getTaskId(); + String taskDetailUrl = REDIRECT_URL_USER + task.getTaskId(); if (isManager) { if (notificationType == NotificationType.TASK_REQUESTED) { - taskDetailUrl = "http://localhost:5173/requested?taskId=" + task.getTaskId(); + taskDetailUrl = REDIRECT_URL_TASK_REQUEST + task.getTaskId(); } else { - taskDetailUrl = "http://localhost:5173/my-task?taskId=" + task.getTaskId(); + taskDetailUrl = REDIRECT_URL_MANAGER + task.getTaskId(); } } return taskDetailUrl; diff --git a/src/main/resources/notifications.yml b/src/main/resources/notifications.yml index a64ec559..f6c80a67 100644 --- a/src/main/resources/notifications.yml +++ b/src/main/resources/notifications.yml @@ -13,7 +13,15 @@ spring: webhook: kakaowork: - url: ${KAKAOWORK_WEBHOOK_URL} + url: https://api.kakaowork.com/v1/messages.send_by_email auth: ${KAKAOWORK_WEBHOOK_AUTH} agit: - url: ${AGIT_WEBHOOK_URL} \ No newline at end of file + url: ${AGIT_WEBHOOK_URL} + +redirect: + url: + user: ${USER_URL} + manger: ${MANAGER_URL} + login: ${LOGIN_URL} + task: + request: ${TASK_REQUEST_URL} \ No newline at end of file From 8d08ac87ce61b21c63af01986dd605ed03f6d1bd Mon Sep 17 00:00:00 2001 From: andrew Date: Fri, 7 Feb 2025 14:28:33 +0900 Subject: [PATCH 2/2] =?UTF-8?q?CLAP-315=20Fix=20:=20=EC=9E=98=EB=AA=BB=20?= =?UTF-8?q?=EC=98=AC=EB=A6=B0=20commit=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/notifications.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/notifications.yml b/src/main/resources/notifications.yml index f6c80a67..66e750a0 100644 --- a/src/main/resources/notifications.yml +++ b/src/main/resources/notifications.yml @@ -13,7 +13,7 @@ spring: webhook: kakaowork: - url: https://api.kakaowork.com/v1/messages.send_by_email + url: ${KAKAOWORK_WEBHOOK_URL} auth: ${KAKAOWORK_WEBHOOK_AUTH} agit: url: ${AGIT_WEBHOOK_URL}