-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'dev' into #315-bump-mongoose-version-to-6.11.3
- Loading branch information
Showing
17 changed files
with
4,218 additions
and
3,785 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const { slackWebhookUrl: slackUrl } = require("../../loadenv"); | ||
const axios = require("axios"); | ||
const logger = require("../modules/logger"); | ||
|
||
module.exports.notifyToReportChannel = (reportUser, report) => { | ||
if (!slackUrl.report) return; | ||
|
||
const data = { | ||
text: `${reportUser}님으로부터 신고가 접수되었습니다. | ||
신고자 ID: ${report.creatorId} | ||
신고 ID: ${report.reportedId} | ||
방 ID: ${report.roomId ?? ""} | ||
사유: ${report.type} | ||
기타: ${report.etcDetail} | ||
`, | ||
}; | ||
const config = { "Content-Type": "application/json" }; | ||
|
||
axios | ||
.post(slackUrl.report, data, config) | ||
.then((res) => { | ||
logger.info("Slack webhook sent successfully"); | ||
}) | ||
.catch((err) => { | ||
logger.error("Fail to send slack webhook", err); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
const { aws: awsEnv } = require("../../../loadenv"); | ||
|
||
const logger = require("../logger"); | ||
// Load the AWS-SDK and s3 | ||
const AWS = require("aws-sdk"); | ||
AWS.config.update({ | ||
region: "ap-northeast-2", | ||
signatureVersion: "v4", | ||
}); | ||
|
||
const s3 = new AWS.S3({ apiVersion: "2006-03-01" }); | ||
const ses = new AWS.SES({ apiVersion: "2010-12-01" }); | ||
|
||
// function to list Object | ||
module.exports.getList = (directoryPath, cb) => { | ||
|
@@ -80,3 +83,37 @@ module.exports.foundObject = (filePath, cb) => { | |
module.exports.getS3Url = (filePath) => { | ||
return `${awsEnv.s3Url}${filePath}`; | ||
}; | ||
|
||
module.exports.sendReportEmail = (reportedEmail, report, html) => { | ||
const reportTypeMap = { | ||
"no-settlement": "정산을 하지 않음", | ||
"no-show": "택시에 동승하지 않음", | ||
"etc-reason": "기타 사유", | ||
}; | ||
|
||
const params = { | ||
Destination: { | ||
ToAddresses: [reportedEmail], | ||
}, | ||
Message: { | ||
Body: { | ||
Html: { | ||
Data: html, | ||
}, | ||
}, | ||
Subject: { | ||
Charset: "UTF-8", | ||
Data: `[SPARCS TAXI] 신고가 접수되었습니다 (사유: ${reportTypeMap[report.type]})`, | ||
}, | ||
}, | ||
Source: "[email protected]", | ||
}; | ||
|
||
ses.sendEmail(params, (err, data) => { | ||
if (err) { | ||
logger.error("Fail to send email", err); | ||
} else { | ||
logger.info("Email sent successfully"); | ||
} | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const { frontUrl } = require("../../loadenv"); | ||
const emailPage = require("./emailPage"); | ||
|
||
module.exports = (name, nickname, roomName, payer, roomId) => | ||
emailPage( | ||
"미정산 내역 관련 안내", | ||
`<b><font color="#6E3678">${name} (${nickname})</font></b> 님께<br /><br /> | ||
안녕하세요, ${name} (${nickname}) 님.<br /> | ||
KAIST 학부 총학생회 산하 특별기구 SPARCS의 Taxi 팀입니다.<br /><br /> | ||
최근 참여하신 방에서 정산이 이루어지지 않았다는 사용자의 문의가 접수되어 메일을 보내드립니다.<br /><br /> | ||
<div style="background: #EEEEEE; border-radius: 20px; margin: padding: 16px 24px; padding: 16px 24px; "> | ||
<div style="margin: 0; padding: 0;"> | ||
<span style="width: 64px; display: inline-block;"><b>방 제목</b></span> | ||
${roomName} | ||
</div> | ||
<div style="margin: 0; padding: 0;"> | ||
<span style="width: 64px; display: inline-block;"><b>결제자</b></span> | ||
${payer} | ||
</div> | ||
<div style="margin: 0; padding: 0;"> | ||
<span style="width: 64px; display: inline-block;"><b>링크</b></span> | ||
<a href="${frontUrl}/myroom/${roomId}" target="_blank">${frontUrl}/myroom/${roomId}</a> | ||
</div> | ||
</div><br /> | ||
위 방에서 채팅을 확인하실 수 있으며, <b>결제하신 분께 해당 금액을 정산</b>해주시기를 부탁드립니다.<br /> | ||
<b>미정산이 반복되는 경우 Taxi 서비스 이용이 제한</b>될 수 있음을 알려드립니다.<br /> | ||
문의가 필요하신 경우, <a href="${frontUrl}/mypage" target="_blank">택시 서비스 내부</a>의 "채널톡 문의하기" 혹은 메일 회신 주시면 됩니다.<br /><br /> | ||
감사합니다.<br /> | ||
SPARCS Taxi팀 드림. | ||
` | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const { getS3Url } = require("../modules/stores/aws"); | ||
|
||
module.exports = ( | ||
title, | ||
content | ||
) => `<div style="font-family: system-ui; position: relative; background: #ffffff; margin: 0; padding: 72px;"> | ||
<div style="width: max(min(100%, 800px), 320px); margin: 0 auto; padding 0;"> | ||
<div style="height: 102px; background: #6E3678; margin: 0 0 48px; padding: 0;"> | ||
<img style="height: 54px; margin: 24px 32px; padding: 0;" src="${getS3Url( | ||
"/assets/email-taxi-logo-white.svg" | ||
)}" alt="Taxi" /> | ||
</div> | ||
${ | ||
title | ||
? `<div style="font-family: system-ui; line-height: 160%; letter-spacing: 0px; font-size: 32px; font-weight: bold; color: #000000; margin: 0 0 32px; padding: 0;">${title}</div>` | ||
: "" | ||
} | ||
<div style="font-family: system-ui; line-height: 160%; letter-spacing: 0px; font-size: 16px; font-weight: regular; color: #000000; margin: 0; padding: 0;">${content}</div> | ||
<div style="border-top: 2px solid #999999; text-align: center; margin: 120px 0 0; padding: 24px 0 0;"> | ||
<img style="height: 54px; margin: 0; padding: 0;" src="${getS3Url( | ||
"/assets/email-sparcs-logo-black.svg" | ||
)}" alt="SPARCS" /> | ||
<a href="https://www.sparcs.org" target="_blank"> | ||
<div style="margin: 0; padding: 0;"> | ||
<u style="font-family: system-ui; font-size: 12px; font-weight: lighter; color: #999999;">www.sparcs.org</u> | ||
</div> | ||
</a> | ||
<div style="font-family: system-ui; font-size: 12px; font-weight: lighter; color: #999999; margin: 0; padding: 0;">[email protected]</div> | ||
</div> | ||
</div> | ||
</div>`; |
Oops, something went wrong.