Skip to content

Commit 5e92a2c

Browse files
committed
CLAP-247 Fix: 작업 상세 조회페이지 url 양식 추가
1 parent 183446a commit 5e92a2c

File tree

8 files changed

+34
-33
lines changed

8 files changed

+34
-33
lines changed

src/main/java/clap/server/adapter/outbound/api/AgitClient.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package clap.server.adapter.outbound.api;
22

33
import clap.server.adapter.outbound.api.dto.PushNotificationTemplate;
4-
import clap.server.adapter.outbound.persistense.entity.notification.constant.NotificationType;
54
import clap.server.application.port.outbound.webhook.SendAgitPort;
65
import clap.server.common.annotation.architecture.ExternalApiAdapter;
76
import lombok.RequiredArgsConstructor;
@@ -26,7 +25,7 @@ public void sendAgit(PushNotificationTemplate request) {
2625
headers.add("Content-Type", "application/json");
2726

2827
RestTemplate restTemplate = new RestTemplate();
29-
String taskUrl = "https://210.109.59.9/api/tasks/" + request.taskId();
28+
String taskUrl = "https://www.naver.com"; //Todo 작업 상세페이지 url 추가
3029

3130
String message = switch (request.notificationType()) {
3231
case TASK_REQUESTED -> "📌 *새 작업 요청:* `" + request.taskName() + "`\\n"

src/main/java/clap/server/adapter/outbound/api/EmailTemplateBuilder.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,39 +10,46 @@
1010
@Component
1111
@RequiredArgsConstructor
1212
public class EmailTemplateBuilder {
13+
1314
private final SpringTemplateEngine templateEngine;
1415

1516
public EmailTemplate createWebhookTemplate(PushNotificationTemplate request) {
1617
Context context = new Context();
1718
String templateName = "";
1819
String subject = "";
20+
String taskDetailUrl = "https://www.naver.com"; //ToDo task 상세 조회페이지 url 추가
1921
switch (request.notificationType()) {
2022
case TASK_REQUESTED:
2123
templateName = "task-request";
2224
subject = "[TaskFlow 알림] 신규 작업이 요청되었습니다.";
25+
context.setVariable("taskDetailUrl", taskDetailUrl);
2326
context.setVariable("receiverName", request.senderName());
2427
context.setVariable("title", request.taskName());
2528
break;
2629
case STATUS_SWITCHED:
2730
templateName = "status-switched";
2831
subject = "[TaskFlow 알림] 작업 상태가 변경되었습니다.";
32+
context.setVariable("taskDetailUrl", taskDetailUrl);
2933
context.setVariable("receiverName", request.senderName());
3034
context.setVariable("title", request.taskName());
3135
break;
3236
case PROCESSOR_CHANGED:
3337
templateName = "processor-changed";
3438
subject = "[TaskFlow 알림] 작업 담당자가 변경되었습니다.";
39+
context.setVariable("taskDetailUrl", taskDetailUrl);
3540
context.setVariable("processorName", request.message());
3641
context.setVariable("title", request.taskName());
3742
break;
3843
case PROCESSOR_ASSIGNED:
3944
templateName = "processor-assigned";
4045
subject = "[TaskFlow 알림] 작업 담당자가 지정되었습니다.";
46+
context.setVariable("taskDetailUrl", taskDetailUrl);
4147
context.setVariable("processorName", request.message());
4248
context.setVariable("title", request.taskName());
4349
break;
4450
case COMMENT:
4551
subject = "[TaskFlow 알림] 댓글이 작성되었습니다.";
52+
context.setVariable("taskDetailUrl", taskDetailUrl);
4653
context.setVariable("comment", request.message());
4754
context.setVariable("title", request.taskName());
4855
break;

src/main/java/clap/server/adapter/outbound/api/KakaoWorkBlockBuilder.java

Lines changed: 21 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,24 @@ public class KakaoWorkBlockBuilder {
1515
private final ObjectMapper objectMapper;
1616

1717
public String makeObjectBlock(PushNotificationTemplate request){
18+
String taskDetailUrl = "https://www.naver.com";
1819
return switch (request.notificationType()) {
19-
case TASK_REQUESTED -> makeTaskRequestBlock(request);
20-
case STATUS_SWITCHED -> makeTaskStatusBlock(request);
21-
case PROCESSOR_CHANGED -> makeProcessorChangeBlock(request);
22-
case PROCESSOR_ASSIGNED -> makeNewProcessorBlock(request);
23-
case COMMENT -> makeCommentBlock(request);
20+
case TASK_REQUESTED -> makeTaskRequestBlock(request, taskDetailUrl);
21+
case STATUS_SWITCHED -> makeTaskStatusBlock(request, taskDetailUrl);
22+
case PROCESSOR_CHANGED -> makeProcessorChangeBlock(request, taskDetailUrl);
23+
case PROCESSOR_ASSIGNED -> makeNewProcessorBlock(request, taskDetailUrl);
24+
case COMMENT -> makeCommentBlock(request, taskDetailUrl);
2425
default -> null;
2526
};
2627
}
2728

28-
private String makeTaskRequestBlock(PushNotificationTemplate request) {
29-
// Blocks 데이터 생성
29+
private String makeTaskRequestBlock(PushNotificationTemplate request, String taskDetailUrl) {
3030
Object[] blocks = new Object[]{
31-
// Header 블록
3231
Map.of(
3332
"type", "header",
3433
"text", "TaskFlow 작업 요청 알림",
3534
"style", "blue"
3635
),
37-
// Text 블록 1
3836
Map.of(
3937
"type", "text",
4038
"text", "TaskFlow 작업 요청 알림",
@@ -46,7 +44,6 @@ private String makeTaskRequestBlock(PushNotificationTemplate request) {
4644
)
4745
}
4846
),
49-
// Text 블록 2: 제목 변수 사용
5047
Map.of(
5148
"type", "text",
5249
"text", "TaskFlow 작업 요청 알림",
@@ -58,7 +55,6 @@ private String makeTaskRequestBlock(PushNotificationTemplate request) {
5855
)
5956
}
6057
),
61-
// Text 블록 3: 요청자 변수 사용
6258
Map.of(
6359
"type", "text",
6460
"text", "TaskFlow 작업 요청 알림",
@@ -70,15 +66,14 @@ private String makeTaskRequestBlock(PushNotificationTemplate request) {
7066
)
7167
}
7268
),
73-
// Button 블록
7469
Map.of(
7570
"type", "button",
7671
"text", "확인하기",
7772
"style", "default",
7873
"action", Map.of(
7974
"type", "open_system_browser",
8075
"name", "button1",
81-
"value", "http://example.com/details/999"
76+
"value", taskDetailUrl
8277
)
8378
)
8479
};
@@ -87,7 +82,7 @@ private String makeTaskRequestBlock(PushNotificationTemplate request) {
8782
try {
8883
payload = "{" +
8984
"\"email\":\"" + request.email() + "\"," +
90-
"\"text\": \"신규 작업 요청 알림\"," + // fallback 메시지
85+
"\"text\": \"신규 작업 요청 알림\"," +
9186
"\"blocks\":" + objectMapper.writeValueAsString(blocks) +
9287
"}";
9388
} catch (JsonProcessingException e) {
@@ -97,7 +92,7 @@ private String makeTaskRequestBlock(PushNotificationTemplate request) {
9792
return payload;
9893
}
9994

100-
private String makeNewProcessorBlock(PushNotificationTemplate request) {
95+
private String makeNewProcessorBlock(PushNotificationTemplate request, String taskDetailUrl) {
10196
Object[] blocks = new Object[]{
10297
Map.of(
10398
"type", "header",
@@ -144,7 +139,7 @@ private String makeNewProcessorBlock(PushNotificationTemplate request) {
144139
"action", Map.of(
145140
"type", "open_system_browser",
146141
"name", "button1",
147-
"value", "http://example.com/details/999"
142+
"value", taskDetailUrl
148143
)
149144
)
150145
};
@@ -153,7 +148,7 @@ private String makeNewProcessorBlock(PushNotificationTemplate request) {
153148
try {
154149
payload = "{" +
155150
"\"email\":\"" + request.email() + "\"," +
156-
"\"text\":\"작업 담당자 선정 알림\"," + // fallback 메시지
151+
"\"text\":\"작업 담당자 선정 알림\"," +
157152
"\"blocks\":" + objectMapper.writeValueAsString(blocks) +
158153
"}";
159154
} catch (JsonProcessingException e) {
@@ -163,7 +158,7 @@ private String makeNewProcessorBlock(PushNotificationTemplate request) {
163158
return payload;
164159
}
165160

166-
private String makeProcessorChangeBlock(PushNotificationTemplate request) {
161+
private String makeProcessorChangeBlock(PushNotificationTemplate request, String taskDetailUrl) {
167162
Object[] blocks = new Object[]{
168163
Map.of(
169164
"type", "header",
@@ -210,7 +205,7 @@ private String makeProcessorChangeBlock(PushNotificationTemplate request) {
210205
"action", Map.of(
211206
"type", "open_system_browser",
212207
"name", "button1",
213-
"value", "http://example.com/details/999"
208+
"value", taskDetailUrl
214209
)
215210
)
216211
};
@@ -219,7 +214,7 @@ private String makeProcessorChangeBlock(PushNotificationTemplate request) {
219214
try {
220215
payload = "{" +
221216
"\"email\":\"" + request.email() + "\"," +
222-
"\"text\":\"작업 담당자 변경 알림\"," + // fallback 메시지
217+
"\"text\":\"작업 담당자 변경 알림\"," +
223218
"\"blocks\":" + objectMapper.writeValueAsString(blocks) +
224219
"}";
225220
} catch (JsonProcessingException e) {
@@ -230,7 +225,7 @@ private String makeProcessorChangeBlock(PushNotificationTemplate request) {
230225
return payload;
231226
}
232227

233-
private String makeCommentBlock(PushNotificationTemplate request) {
228+
private String makeCommentBlock(PushNotificationTemplate request, String taskDetailUrl) {
234229
Object[] blocks = new Object[]{
235230
Map.of(
236231
"type", "header",
@@ -288,7 +283,7 @@ private String makeCommentBlock(PushNotificationTemplate request) {
288283
"action", Map.of(
289284
"type", "open_system_browser",
290285
"name", "button1",
291-
"value", "http://example.com/details/999"
286+
"value", taskDetailUrl
292287
)
293288
)
294289
};
@@ -297,7 +292,7 @@ private String makeCommentBlock(PushNotificationTemplate request) {
297292
try {
298293
payload = "{" +
299294
"\"email\":\"" + request.email() + "\"," +
300-
"\"text\":\"댓글 알림\"," + // fallback 메시지
295+
"\"text\":\"댓글 알림\"," +
301296
"\"blocks\":" + objectMapper.writeValueAsString(blocks) +
302297
"}";
303298
} catch (JsonProcessingException e) {
@@ -307,7 +302,7 @@ private String makeCommentBlock(PushNotificationTemplate request) {
307302
return payload;
308303
}
309304

310-
private String makeTaskStatusBlock(PushNotificationTemplate request) {
305+
private String makeTaskStatusBlock(PushNotificationTemplate request, String taskDetailUrl) {
311306
Object[] blocks = new Object[]{
312307
Map.of(
313308
"type", "header",
@@ -354,7 +349,7 @@ private String makeTaskStatusBlock(PushNotificationTemplate request) {
354349
"action", Map.of(
355350
"type", "open_system_browser",
356351
"name", "button1",
357-
"value", "http://example.com/details/999"
352+
"value", taskDetailUrl
358353
)
359354
)
360355
};
@@ -363,7 +358,7 @@ private String makeTaskStatusBlock(PushNotificationTemplate request) {
363358
try {
364359
payload = "{" +
365360
"\"email\":\"" + request.email() + "\"," +
366-
"\"text\":\"작업 상태 변경 알림\"," + // fallback 메시지
361+
"\"text\":\"작업 상태 변경 알림\"," +
367362
"\"blocks\":" + objectMapper.writeValueAsString(blocks) +
368363
"}";
369364
} catch (JsonProcessingException e) {

src/main/resources/templates/comment.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<li>내용: <span th:text="${comment}"></span></li>
7575
</ul>
7676
<div class="cta-button">
77-
<a href="https://www.notion.so" target="_blank">확인하기</a>
77+
<a href="https://example.com/task/1" target="_blank" th:href="${taskDetailUrl}">확인하기</a>
7878
</div>
7979
</div>
8080
<div class="footer">

src/main/resources/templates/processor-assign.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<li>담당자: <span th:text="${processorName}"></span></li>
7575
</ul>
7676
<div class="cta-button">
77-
<a href="https://www.notion.so" target="_blank">확인하기</a>
77+
<a href="https://example.com/task/1" target="_blank" th:href="${taskDetailUrl}">확인하기</a>
7878
</div>
7979
</div>
8080
<div class="footer">

src/main/resources/templates/processor-change.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<li>담당자: <span th:text="${processorName}"></span></li>
7575
</ul>
7676
<div class="cta-button">
77-
<a href="https://www.notion.so" target="_blank">확인하기</a>
77+
<a href="https://example.com/task/1" target="_blank" th:href="${taskDetailUrl}">확인하기</a>
7878
</div>
7979
</div>
8080
<div class="footer">

src/main/resources/templates/status-switch.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<li>작업 상태: <span th:text="${status}"></span></li>
7575
</ul>
7676
<div class="cta-button">
77-
<a href="https://www.notion.so" target="_blank">확인하기</a>
77+
<a href="https://example.com/task/1" target="_blank" th:href="${taskDetailUrl}">확인하기</a>
7878
</div>
7979
</div>
8080
<div class="footer">

src/main/resources/templates/task-request.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<li>제목: <span th:text="${title}"></span></li>
7575
</ul>
7676
<div class="cta-button">
77-
<a href="https://www.notion.so" target="_blank">확인하기</a>
77+
<a href="https://example.com/task/1" target="_blank" th:href="${taskDetailUrl}">확인하기</a>
7878
</div>
7979
</div>
8080
<div class="footer">

0 commit comments

Comments
 (0)