Skip to content

Conversation

oldmonad
Copy link
Owner

What does this PR do?

  • This PR adds the functionality to enable users post a comment on a question

Description of Task to be completed?

  • Have the POST /api/v1/comments route working

How should this be manually tested?

  • Clone the repo and run npm install to install dependencies.
  • Download and install postgresql from this link
  • Setup postgreql using this guide
  • run npm migrate to create the tables
  • run npm start:dev to start server
  • check the server/test/testData folder route for the input formats and proceed to testing with postman.

What are the relevant pivotal tracker stories?

  • #163421750

NB

  • I have written the model logic for rsvps and votes but I have not hooked in the routes yet so you can just ignore that part and I also fixed the variables to fit the recommended camelcase or snakecase format

Copy link

@Veraclins Veraclins left a comment

Choose a reason for hiding this comment

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

Great job! This is beginning to take a good shape. Keep it up. Just see the comments I left and attend to them and you should be good to go.

}

newComment.title = checkquestion.title;
newComment.body = checkquestion.body;

Choose a reason for hiding this comment

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

Why are you duplicating question title and body on the comment? I think the only thing the comment needs from the question is the Id.

Copy link
Owner Author

Choose a reason for hiding this comment

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

I thought as much!, it's in the project rubric and I try to follow it as much as possible

router.patch('/:meetupId/rsvps', Auth.verifyToken, tryCatch(rsvpController.respondToRsvp));
router.delete('/:id', Auth.verifyToken, Auth.adminAuth, tryCatch(meetupController.deleteMeetup));
router.patch('/:meetupId/rsvps', Auth.verifyToken, validateId, tryCatch(rsvpController.respondToRsvp));
router.delete('/:id', Auth.verifyToken, Auth.adminAuth, validateId, tryCatch(meetupController.deleteMeetup));

Choose a reason for hiding this comment

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

Since Auth.verifyToken is applied to all the routes here, you can move it to the index file to remove the repetition.

@oldmonad oldmonad merged commit a722505 into develop Jan 24, 2019
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.

2 participants