Skip to content

[SSF 195] - FM Required Actions Frontend#166

Open
dburkhart07 wants to merge 10 commits intomainfrom
ddb/SSF-195-fm-required-actions-frontend
Open

[SSF 195] - FM Required Actions Frontend#166
dburkhart07 wants to merge 10 commits intomainfrom
ddb/SSF-195-fm-required-actions-frontend

Conversation

@dburkhart07
Copy link
Copy Markdown

@dburkhart07 dburkhart07 commented Apr 26, 2026

ℹ️ Issue

Closes #195

📝 Description

Backend changes:
I realized during development that the single order updating was deprecated, as we needed a way to update the tracking link and shipping cost for all of the orders at once. Therefore, I added a new endpoint and service function (as well as tests) for this, and got rid of the old one. The backend now takes in ether the shipping cost or tracking link for each order from the donation, and updates the order to shipped when both are provided eventually. Additionally, I also realized now that we would need to make it so that we can edit fields for confirming a donation item, even after it gets confirmed. I modularized the old confirm donation item details endpoint to accept all fields as optional, and rather just serve as an update function that, in the even where all fields got values, we would make it so the details became confimred.

Frontend changes:
As this logic is somewhat confusing, I made the frontend page with a few changes to the design.

Order section:
We display all pending orders for the donation, with the option to add shipping cost (SC) and tracking link (TL). Since each order only becomes shipped when SC and TL are provided, while we allow users to only provide one, it will remain pending (and therefore in the modal) until both are provided. We bulk update all of the edited SC and TL fields at once through a single api call and DB transaction.

Donation item detail confirmation:
This modal is provided to the user to confirm details for all donation items that are being used in the pending orders from the previous modal. It displays all of them, whether they are confirmed or not (maybe some of the items were confirmed from a previous order). The user cannot submit the form until they have confirmed the details for all items from all the pending orders, regardless of which ones they provided a SC and TL for. After initial submission, should they still have pending orders to provide SC and TL for, each time, they have the option to update oz. per item, estimated value, or food rescue for each of the items. We also send all updates to all donation items to the backend in bulk, only updating the detail confirmation for items that end up having all 3 fields populated off of that API call.

Submission:
On submit, we do the donation item detail confirmation API call first. This is because we want to set the donation item details to confirmed before updating SC and TL, since after that we move the order to shipped, and can potentially the donation from matched to fulfilled if all its items are not shipped off.

✔️ Verification

  • Tested new/endpoints in Postman
  • Made sure all tests passed

Screenshots of pages:
image
image
image

🏕️ (Optional) Future Work / Notes

N/A

@Yurika-Kan Yurika-Kan self-assigned this May 1, 2026
Copy link
Copy Markdown
Collaborator

@Yurika-Kan Yurika-Kan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

round 1 comments!!!

Comment thread apps/backend/src/orders/order.controller.ts
Comment thread apps/frontend/src/containers/foodManufacturerDonationManagement.tsx
Comment thread apps/backend/src/orders/order.service.ts
Comment thread apps/backend/src/orders/order.service.ts Outdated
Comment thread apps/backend/src/orders/order.service.spec.ts
body: ConfirmDonationItemDetailsDto[],
@Body(new ParseArrayPipe({ items: UpdateDonationItemDetailsDto }))
body: UpdateDonationItemDetailsDto[],
): Promise<Donation> {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can make this return void!!!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im fine with doing this. right now, however, a lot of our patches throughout our code have a mix of returning void, or the entity. i think we should standardize this to either, return void for all of them, or return the updated entity for all of them. we dont really do anything with the updated info, so im more in favor of doing void, but let me know your thoughts.

Copy link
Copy Markdown
Collaborator

@Yurika-Kan Yurika-Kan May 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super agree ive been suggesting returning void for these endpoints that i find since there is no need for the backend to expose those info to the frontend if it's not being used!

Copy link
Copy Markdown
Author

@dburkhart07 dburkhart07 May 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ill update all of them. There are a few where we rely on the output though for the frontend (the ones used in Profile updating).

Comment thread apps/backend/src/donations/donations.service.ts Outdated
Comment thread apps/backend/src/donations/donations.service.ts Outdated
Comment thread apps/backend/src/donations/donations.service.ts Outdated
Comment thread apps/backend/src/foodManufacturers/manufacturers.service.ts Outdated
@Yurika-Kan Yurika-Kan requested a review from Juwang110 May 2, 2026 13:31
Comment thread apps/frontend/src/containers/foodManufacturerDonationManagement.tsx Outdated
Comment thread apps/frontend/src/containers/foodManufacturerDonationManagement.tsx Outdated
@dburkhart07 dburkhart07 requested a review from Yurika-Kan May 3, 2026 18:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants