Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Luis add email notifcation to warning tracker backend #1123

Merged

Conversation

luisarevalo21
Copy link
Contributor

Description

Backend for sending an email,
Notable changes were, adding new functions to send the email, adjusted the filter method, and added helper functions to get the admin of the team .

Related PRS (if any):

To test this backend PR you need to checkout the #2752 frontend PR.

Main changes explained:

--created helper functions to send an email, but filtering and fetching the admin of the team.
--adjust filtering to check if an email should or shouldn't be sent

How to test:

  1. check into current branch
  2. do npm run build && npm run start
  3. follow steps of the frontend PR #2752

Note:

Ensure you follow the steps of the Frontend PR and Ivy Chen's PR.

@luisarevalo21 luisarevalo21 removed the Do Not Review Do not review or look at code without full context label Oct 11, 2024
Copy link
Contributor

@Ankuriboh Ankuriboh left a comment

Choose a reason for hiding this comment

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

Can confirm that the code works as intended, but there's some inconsistency between the API designs that can definitely be improved there.


const testWarning = checkIfSpecialCharacter(newWarning);
if (testWarning) {
return res.status(200).send({
Copy link
Contributor

Choose a reason for hiding this comment

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

Errors shouldn't be returning a 200 code, a generic 400 should be enough. And why is errors returning two different bodies? ({ message: string } and { error: string })

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hello
Thanks for the feedback!
I send a 200 because if I send a 400 error, there is a red warning that appears in the console and wanted to avoid that. After reaching out team members this was the solution

src/controllers/currentWarningsController.js Outdated Show resolved Hide resolved
src/controllers/warningsController.js Outdated Show resolved Hide resolved
src/controllers/warningsController.js Outdated Show resolved Hide resolved
src/controllers/currentWarningsController.js Show resolved Hide resolved
@one-community
Copy link
Member

Thank you all, merging!

@one-community one-community merged commit eafa526 into development Dec 18, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants