Skip to content
This repository was archived by the owner on Sep 30, 2023. It is now read-only.

Modified email based on destination and the creation of a commendation#22

Open
Konolo wants to merge 5 commits intomasterfrom
feature/send-team-commendation
Open

Modified email based on destination and the creation of a commendation#22
Konolo wants to merge 5 commits intomasterfrom
feature/send-team-commendation

Conversation

@Konolo
Copy link

@Konolo Konolo commented Jan 4, 2023

In the create function of the commendations controller, I added a check for if the commendation is for a team or not. In the emailOthers function of the email utils file, I modified the email based on if the commendation is for a team.

@Konolo Konolo requested a review from SpBills January 4, 2023 22:50
Copy link
Contributor

@SpBills SpBills left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Just a few syntax things.

newCommendation.date = new Date().toISOString();

let isTeamCommendation = () => {
return (req.query.isTeamCommendation === "true")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. Why make it a function if it's scoped to here anyways? You can inline this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, whenever we declare functions, we declare them as const since they can never be changed. Good job understanding the syntax, though.

export const emailOthers = async (commendation: Commendation, team: boolean) => {
let senderName = await getEmployeeName(commendation.fromEmail);
let userName = await getEmployeeName(commendation.toEmail);
let Subject = "";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lower case

to: commendation.otherEmails,
from: process.env.EMAIL,
subject: `[bz_commendations] ${userName} has received a BZ Commendation`,
subject: Subject,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great.

@SpBills SpBills linked an issue Jan 10, 2023 that may be closed by this pull request
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add BZ Commendation for team

2 participants