VikeLabs/Collabify

[BACKEND] - Create database function for deleting an event from group (deleteEventFromGroup)

Closed this issue · 0 comments

Screenshot 2022-10-22 125507
^ This is how we add and update the availability

Make the decision:

  • Should we be removing the ID from the group events array first THEN delete the events model. We have to consider that when we get the events we get it from the group events array. So should we be making sure that the events array ID gets deleted before we delete the events model?

Task:

  • Inside the /db/event.js file create a function called deleteEventFromGroup should have the document id as a parameter
  • instead of saving the event model we need delete the event model (https://mongoosejs.com/docs/models.html#deleting)
  • with the id we passed we need to remove it from the Group array (hint: use the $pull operation)