hack4impact-calpoly / cp-ccc-uss

2 stars 0 forks source link

09 create volunteer endpoints (repost) #23

Closed hnadrian closed 1 month ago

hnadrian commented 3 months ago

Developer: Xavier Garcia

Closes #9

Pull Request Summary

In this branch, I have created and tested endpoints:

Modifications

Created directories:

Testing Considerations

I used the Boomerang extension to test each endpoint manually with the Mongo Dev DB and a localhost server. Additional tests can be done to confirm my results.

Pull Request Checklist

hnadrian commented 3 months ago

@xgarcia17 I made a new request for your issue. This code should be the same. There is one more endpoint DELETE to implement.

hnadrian commented 3 months ago

Code for the additional DELETE endpoint looks great and works! Nice job

andrewtchan commented 3 months ago

@hnadrian I think this is actually more involved. When deleting a Volunteer fully from the database, we have to do the following:

  1. Delete all VolunteerEntries associated with them
  2. Delete all references to the Volunteer in VolunteerRoles they appear in. This means going into the timeslots array for each of those VolunteerRoles and removing their id from the volunteers array in each timeslot. However, we may not want to delete historical data of Volunteers who volunteered as a role for an event then were deleted from the db.

Here's what I propose: we add a field "active" which is a boolean to the Volunteer schema. Instead of our delete endpoint actually deleting data, we just set this boolean to False. This way we don't have to go delete references and entries which may be data we actually want to preserve.

Let me know what you think. We can also leave this PR open and come back when this becomes relevant.

hnadrian commented 3 months ago

@andrewtchan Thanks for catching this. You're right referencing a nonexistent volunteer is an issue. I agree we should have an active boolean for the schema! This means we will also make changes to other endpoints for this PR to include active boolean

hnadrian commented 1 month ago

Okay, the volunteer schema change with active boolean is added. Endpoints got some small changes as a result. Tested with Postman. Waiting for review and merge @andrewtchan