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 @@ -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;
Expand All @@ -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 = "";
Expand Down Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 9 additions & 1 deletion src/main/resources/notifications.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,12 @@ webhook:
url: ${KAKAOWORK_WEBHOOK_URL}
auth: ${KAKAOWORK_WEBHOOK_AUTH}
agit:
url: ${AGIT_WEBHOOK_URL}
url: ${AGIT_WEBHOOK_URL}

redirect:
url:
user: ${USER_URL}
manger: ${MANAGER_URL}
login: ${LOGIN_URL}
task:
request: ${TASK_REQUEST_URL}