Skip to content

Commit 7f76497

Browse files
committed
fix: Message 타입 수정
1 parent b0695a8 commit 7f76497

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/index.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ import { SESClient, SendEmailCommand } from '@aws-sdk/client-ses';
33

44
export const handler: SQSHandler = async (event: SQSEvent) => {
55
const body = event.Records[0]!.body;
6-
console.log('body:', body);
76
const message = JSON.parse(body) as ReservationMessage;
8-
console.log('message:', message);
7+
const project = message.project;
98
const sesClient = new SESClient();
109

1110
const githubRepoUrl = 'https://github.com/project-notification/readme/issues';
@@ -18,19 +17,19 @@ export const handler: SQSHandler = async (event: SQSEvent) => {
1817
<p>안녕하세요,</p>
1918
<p>새로운 프로젝트가 등록되었습니다:</p>
2019
<div style="background-color: #f0f0f0; padding: 15px; border-radius: 5px;">
21-
<h2 style="color: #2c3e50; margin-top: 0;">${message.title}</h2>
20+
<h2 style="color: #2c3e50; margin-top: 0;">${project.title}</h2>
2221
<p>자세한 내용을 보려면 아래 링크를 클릭하세요:</p>
2322
<a href="${
24-
message.url
23+
project.url
2524
}" style="display: inline-block; padding: 10px 20px; background-color: #3498db; color: white; text-decoration: none; border-radius: 5px;">프로젝트 보기</a>
2625
</div>
2726
${
28-
message.topics
27+
project.topics
2928
? `
3029
<div style="margin-top: 20px;">
3130
<p>관련 주제:</p>
3231
<ul>
33-
${message.topics.map((topic) => `<li>${topic}</li>`).join('')}
32+
${project.topics.map((topic) => `<li>${topic}</li>`).join('')}
3433
</ul>
3534
</div>
3635
`
@@ -58,11 +57,11 @@ export const handler: SQSHandler = async (event: SQSEvent) => {
5857
Data: htmlBody,
5958
},
6059
Text: {
61-
Data: `새로운 프로젝트가 등록되었습니다. ${message.title} 자세한 내용: ${message.url}\n\n알림 구독 해제: 더 이상 알림을 받지 않으려면 다음 GitHub 저장소에서 귀하의 이슈를 닫아주세요: ${githubRepoUrl}`,
60+
Data: `새로운 프로젝트가 등록되었습니다. ${project.title} 자세한 내용: ${project.url}\n\n알림 구독 해제: 더 이상 알림을 받지 않으려면 다음 GitHub 저장소에서 귀하의 이슈를 닫아주세요: ${githubRepoUrl}`,
6261
},
6362
},
6463
Subject: {
65-
Data: `새 프로젝트 알림: ${message.title}`,
64+
Data: `새 프로젝트 알림: ${project.title}`,
6665
},
6766
},
6867
Source: '[email protected]',
@@ -73,6 +72,10 @@ export const handler: SQSHandler = async (event: SQSEvent) => {
7372

7473
type ReservationMessage = {
7574
email: string;
75+
project: Project;
76+
};
77+
78+
type Project = {
7679
title: string;
7780
url: string;
7881
topics?: string[];

0 commit comments

Comments
 (0)