Skip to content

Conversation

@dhanzy
Copy link
Collaborator

@dhanzy dhanzy commented Aug 5, 2021

What this PR does (required):

  • Controller for notifying users when they've won a contest

Screenshots / Videos (required):

  • Screenshot (34)

Any information needed to test this feature (required):

  • change directory to the server side
  • npm install --save @sendgrid/mail
  • Open up postman
  • Make a BasicAuth to the server
  • Send a post request to http://localhost:3001/contest//winner

Any issues with the current functionality (optional):

  • Email sends but not delivered on Email server
  • This may be due to my account

@dhanzy dhanzy requested review from HAZberi and rajivtitus August 5, 2021 04:47
const user = await User.findById(userID);
const receiver = await User.findById(receiverID);
if (!user || !receiver){
return res.status(500).json({
Copy link
Contributor

@rajivtitus rajivtitus Aug 5, 2021

Choose a reason for hiding this comment

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

Please update this to a 'Not found' status code

}
const contest = await Contest.findById(contestID);
if (!contest){
return res.status(500).json({
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above

let success = false;
const { receiverID } = req.body;
try {
const user = await User.findById(userID);
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason for searching up a 'user' here? If he doesn't exist, how would he have logged in? :)

Copy link
Contributor

@rajivtitus rajivtitus left a comment

Choose a reason for hiding this comment

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

LGTM! Please address comments before meging

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