Deleting Study Groups

In this lesson we’ll create an endpoint to delete an individual study group in the MongoDB database.  The code for this lesson will be written and discussed in class.

Tasks

  • Create DELETE /studygroup/:id endpoint
  • Test on localhost using Postman

Homework

  1. Add DELETE /studygroup/:id endpoint to your router.
  2. Add a functioning delete button next to each group that the user owns in the search results page.
  3. Create new endpoint: PATCH /studygroup/:id/participants?[add][remove] with user: userId in the body
    • Allow:
      • user to add self if studygroup is public
      • user to remove self if studygroup is public or private
  4. Add functioning join button next to each studygroup that the user does not own and is not a member of in the search results page.
  5. Add a functioning leave button next to each studygroup that the user is a member of in the search results page.
  6. Modify GET /studygroups: add “member” to query string.  When “member” is present in the query string, the endpoint returns only study groups that the user is a member of.

© 2024, Eric McGregor. All rights reserved. Unauthorized use, distribution and/or duplication of this material without express and written permission from the author is strictly prohibited.