Conversation
dburkhart07
left a comment
There was a problem hiding this comment.
One small comment but this looks great. Thanks for doing this, it will make future dev work much easier/secure for us!
There was a problem hiding this comment.
left a few comments. i'm wondering if we can add the enums to the types.ts on the frontend side as well? i was also getting errors when running the app in the pantries service, i think you might need to update the PantryApplicationDTO to use your enums
…dy definitions to use enum
dburkhart07
left a comment
There was a problem hiding this comment.
Looks pretty good for the most part. Only small nit that I have is I believe we should add one final enum: reserveFoodForAllergic, which has the values Yes, some, or no. If you could add that into both the backend, database migration, and frontend, that would be great!
…ount for new enums
dburkhart07
left a comment
There was a problem hiding this comment.
One very small suggestion and reviewing Amy's comments, but aside from that lgtm!
amywng
left a comment
There was a problem hiding this comment.
sorry just a few more small things
apps/backend/src/migrations/1760886499863-UpdateColsToUseEnumType.ts
Outdated
Show resolved
Hide resolved
amywng
left a comment
There was a problem hiding this comment.
thank you for all the back and forth and implementing my changes so quickly! lgtm
sam-schu
left a comment
There was a problem hiding this comment.
Just took a look at the change I requested
SSF-54 Backend and DB Enums
ℹ️ Issue
Closes https://vidushimisra.atlassian.net/jira/software/projects/SSF/boards/1?selectedIssue=SSF-54
📝 Description
Conceptually, this PR is pretty simple, it entails refactoring our backend and DB to move away from varchar/text when applicable and move toward enum values where the fields can only be from a set number of values. This ensures safety in the actual values and makes our backend more robust and readable.
I did end up modifying one frontend page, the modal in request-from/pantry:id. This is because in another PR of mine the values for requested-size are different then what is currently on main. To avoid making an enum I knew would be outdated, I simply edited the frontend values to anticipate.
For the backend I modified 3 controller routes: donations/create, requests/create, donation-items/create
✔️ Verification
I verified all enum values based on what the frontend is currently sending the db/backend. I also went through all the pages on main and interacted with the database in every possible way to ensure no issues from refactoring.
🏕️ (Optional) Future Work / Notes
I got ahead of myself and created a donation_frequency_enum for FoodManufacturer when this entity is not yet in main. So as a note, that new entity and table column type will have to reference my new enum.