-
Notifications
You must be signed in to change notification settings - Fork 0
Food request form #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…on the request page, properly collected form data to be used by API
making branch up to date with main
… with service,controller, etc.
| @@ -0,0 +1,243 @@ | |||
| import { | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can delete this entire file since we will be using your requestformmodalbutton instead (and you can delete it from inside foodrequest.tsx)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
| /> | ||
| </FormControl> | ||
| <Flex justifyContent="space-between" mt={4}> | ||
| <Button type="submit">Submit</Button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe we can switch the positions of the submit and cancel button b/c I usually expect submit to be on the right
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
dburkhart07
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes look good! No additional comments.
ℹ️ Issue
Closes Food Request Form
📝 Description
I added a food request form button modal which is a button component that opens a pop up modal which houses a form. This form is for pantries to request food (shipment size, shipment contents). This is important so we can keep track of what certain pantries request. I also created a food-requests backend folder which houses the controller, entity, module and service. This enables API calls to the backend food-requests table. I created two routes, find and create where the create route is used to create a food request in the database based on the form answers.
Briefly list the changes made to the code:
✔️ Verification
What steps did you take to verify your changes work? These should be clear enough for someone to be able to clone the branch and follow the steps themselves.
To verify the frontend part of the component I simply added the component to an existing page (landing page) and verified it looked and worked properly. To verify the backend I had to manually add a user row to PGAdmin and a pantry to PGAdmin to fulfill foreign key constraints for an actual pantry to have a food request. After manually adding this filler data, I submitted the form via the frontend and I verified the new food request in the database.
Provide screenshots of any new components, styling changes, or pages.
🏕️ (Optional) Future Work / Notes
Additional Notes:
Right now in the form component the pantryID is hard coded to submit requests for ID = 1 due to the incomplete implementation of authentication currently.
I did not add any authentication/interceptor for the food-requests backend which might need to be done later on? I'm not really sure if it's needed or how to go about it though.
The existing old food requests route and form still exists, I wasn't sure if I should delete it or not.
TODO:
Add entities for pantries and food manufacturers so many-to-one relationships can be defined in the requests entity because panties/manufacturers can both be associated with multiple requests.
Add these to requests.entity:
manytoone(() => Pantry, (pantry) => pantry.foodRequests, { nullable: false })
joincolumn({ name: 'pantry_id' })
pantry: Pantry;
manytoone(() => FoodManufacturer, (manufacturer) => manufacturer.foodRequests, { nullable: true })
joincolumn({ name: 'fulfilled_by' })
fulfilledByManufacturer: FoodManufacturer;