hack4impact-calpoly / general-vms

General volunteer management system.
2 stars 0 forks source link

Edit Existing Shift Endpoint #38

Closed adameza closed 2 years ago

adameza commented 2 years ago

For issue #12. The endpoint takes any editable shift attributes in the request body and then modifies the shift in the database.

To error check, I decided to first retrieve the existing database entry and then check to make sure the new attributes are safe with the existing ones. The error checking for dates gets a little messy. Do you see a better way?

The jest testing was not making it easy to check for modified shifts. I confirmed that the shift was actually being modified with Postman, but I couldn't integrate it into the tests. I tried outputting the modifying attributes to console.log() but using jest with console.log was not working well.

adameza commented 2 years ago

changed to PUT, it just replaces and existing shift. @bglossner