Skip to content

Commit

Permalink
ran prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
willi-li-am committed Dec 31, 2023
1 parent f46f26f commit f528c89
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 17 deletions.
30 changes: 22 additions & 8 deletions backend/emails/emails.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,12 @@ const getSFTicketInfoHTML = async (sf) => {
Sponsorship Fund: ${sf.name} <br />
Allocated Funding: ${sf.funding_allocation} <br/ >
Funding Spent: ${sf.funding_spent} <br />
${sf.proposal_url? `Proposal URL: ${sf.proposal_url} <br />` : ``}
${sf.presentation_url? `Presentation URL: ${sf.presentation_url} <br />` : ``}
${sf.proposal_url ? `Proposal URL: ${sf.proposal_url} <br />` : ``}
${
sf.presentation_url
? `Presentation URL: ${sf.presentation_url} <br />`
: ``
}
Status: ${sf.status} <br />
Reporter: ${reporter.displayName} &lt;${reporter.email}&gt; <br />
Created: ${new Date(sf.createdAt).toDateString()} <br />
Expand Down Expand Up @@ -275,8 +279,12 @@ const sendEmailPPRReimbursedToReporter = async (ppr) => {

const sendEmailSFReimbursementRequestToCoordinator = async (sf) => {
const Subject = `[Action Needed] Submit Reimbursement Request ${sf.codename}`
const HTMLPart = getMainMessageHTML(`Claim has been submitted for ${sf.codename}! Please review it and submit a reimbursement request. Visit the ticket link below to confirm you have submitted the reimbursement request.`)
+ (await getSFTicketInfoHTML(sf)) + getTicketLinkHTML(sf.path)
const HTMLPart =
getMainMessageHTML(
`Claim has been submitted for ${sf.codename}! Please review it and submit a reimbursement request. Visit the ticket link below to confirm you have submitted the reimbursement request.`
) +
(await getSFTicketInfoHTML(sf)) +
getTicketLinkHTML(sf.path)
const To = await getEmailToSection(sf.reporter_id, [
EMAIL_RECIPIENTS.coordinator,
])
Expand All @@ -289,8 +297,12 @@ const sendEmailSFReimbursementRequestToCoordinator = async (sf) => {

const sendEmailSFConfirmReimbursementSubmitToCoordinator = async (sf) => {
const Subject = `[Action Needed] Confirm Reimbursement Received ${sf.codename}`
const HTMLPart = getMainMessageHTML(`Please visit the ticket link below to confirm you have received the reimbursement for ${sf.codename}.`)
+ (await getSFTicketInfoHTML(sf)) + getTicketLinkHTML(sf.path)
const HTMLPart =
getMainMessageHTML(
`Please visit the ticket link below to confirm you have received the reimbursement for ${sf.codename}.`
) +
(await getSFTicketInfoHTML(sf)) +
getTicketLinkHTML(sf.path)
const To = await getEmailToSection(sf.reporter_id, [
EMAIL_RECIPIENTS.coordinator,
])
Expand All @@ -303,8 +315,10 @@ const sendEmailSFConfirmReimbursementSubmitToCoordinator = async (sf) => {

const sendEmailSFReimbursementReceivedToTeam = async (sf) => {
const Subject = `[Reimbursed] ${sf.codename}`
const HTMLPart = getMainMessageHTML(`${sf.codename} has been reimbursed.`)
+ (await getSFTicketInfoHTML(sf)) + getTicketLinkHTML(sf.path)
const HTMLPart =
getMainMessageHTML(`${sf.codename} has been reimbursed.`) +
(await getSFTicketInfoHTML(sf)) +
getTicketLinkHTML(sf.path)
const To = await getEmailToSection(sf.reporter_id, [
EMAIL_RECIPIENTS.finance,
EMAIL_RECIPIENTS.coordinator,
Expand Down
28 changes: 19 additions & 9 deletions backend/service/sponsorshipfunds.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ const {
getAnnotatedUWFinancePurchasesByIdList,
getAnnotatedSponsorshipFundsByIdList,
} = require('./annotatedGetters')
const { sendEmailSFReimbursementRequestToCoordinator, sendEmailSFConfirmReimbursementSubmitToCoordinator, sendEmailSFReimbursementReceivedToTeam } = require('../emails/emails')
const {
sendEmailSFReimbursementRequestToCoordinator,
sendEmailSFConfirmReimbursementSubmitToCoordinator,
sendEmailSFReimbursementReceivedToTeam,
} = require('../emails/emails')

const getAllSponsorshipFunds = () => {
return getAnnotatedSponsorshipFundsByIdList()
Expand Down Expand Up @@ -51,22 +55,28 @@ const createSponsorshipFund = (body) => {
}

const updateSponsorshipFund = async (id, body) => {
const newSponsorshipFund = await SponsorshipFund.findByIdAndUpdate(id, body, {
new: true,
})
const newSponsorshipFund = await SponsorshipFund.findByIdAndUpdate(
id,
body,
{
new: true,
}
)

const annotatedSponsorshipFund = await getSponsorshipFund(id)
const status = annotatedSponsorshipFund.status

if (status === "CLAIM_SUBMITTED") {
if (status === 'CLAIM_SUBMITTED') {
sendEmailSFReimbursementRequestToCoordinator(annotatedSponsorshipFund)
}

if (status === "SUBMITTED_TO_SF") {
sendEmailSFConfirmReimbursementSubmitToCoordinator(annotatedSponsorshipFund)

if (status === 'SUBMITTED_TO_SF') {
sendEmailSFConfirmReimbursementSubmitToCoordinator(
annotatedSponsorshipFund
)
}

if (status === "REIMBURSED") {
if (status === 'REIMBURSED') {
sendEmailSFReimbursementReceivedToTeam(annotatedSponsorshipFund)
}

Expand Down

0 comments on commit f528c89

Please sign in to comment.