Skip to content

[SSF-213] Create new donation fixes#179

Open
jiang-h-y wants to merge 9 commits into
mainfrom
hj/SSF-213-FM-create-new-donation
Open

[SSF-213] Create new donation fixes#179
jiang-h-y wants to merge 9 commits into
mainfrom
hj/SSF-213-FM-create-new-donation

Conversation

@jiang-h-y

@jiang-h-y jiang-h-y commented May 23, 2026

Copy link
Copy Markdown

ℹ️ Issue

Closes SSF-213

📝 Description

Backend:

  • Auth gated POST /api/donations endpoint so only Food Manufacturers can access it
  • Read in FM ID based on the logged in user instead of allowing FM ID to be passed in
  • Removed FM ID from CreateDonationDTO and updated tests accordingly

Frontend:

  • Extended alert hook to include a status field
  • Refactored implementations of alert hook
  • Ensured a success/error toast after logging a donation in apps/frontend/src/containers/foodManufacturerDonationManagement.tsx

✔️ Verification

  • Tested logging a new donation
  • Tested that non-FMs could not access the createDonation endpoint
  • Tested that the success/error toast renders

Sucess:
image

Error:
image

🏕️ (Optional) Future Work / Notes

  • One of the backend tests fails in workflows but not in terminal because of a small timing difference (not sure why)
    Edit: updated the backend test and now all tests pass
  • Not super sure if manufacturerID is still necessary in apps/frontend/src/containers/donationManagement.tsx

@jxuistrying jxuistrying self-requested a review May 24, 2026 02:59
@dburkhart07 dburkhart07 self-requested a review May 24, 2026 18:00

@dburkhart07 dburkhart07 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'm noticing that the FloatingAlert component uses a status of info | error, whereas the AlertState interface uses success | error. We should standardize this (in my opinion, info | error everywhere). Can we change all the success alert messages to be info instead, create an enum in types to be reused in both the FloatingAlert and AlertState, make it so that all FloatingAlerts now just have status={alertState.status}?

Comment thread apps/frontend/src/components/forms/orderReceivedActionModal.tsx Outdated
Comment thread apps/frontend/src/containers/foodManufacturerApplicationDetails.tsx Outdated
Comment thread apps/backend/src/donations/donations.controller.spec.ts Outdated
Comment thread apps/backend/src/donations/donations.controller.ts Outdated
Comment thread apps/frontend/src/components/forms/changePasswordModal.tsx Outdated
Comment thread apps/frontend/src/components/forms/requestFormModal.tsx Outdated

@jxuistrying jxuistrying left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

When I was smoke testing front end for FM users I noticed both dashboard and all pages are currently highlighted at the same time is that intended?

Image

@dburkhart07 dburkhart07 self-assigned this May 27, 2026
@jiang-h-y jiang-h-y self-assigned this May 28, 2026
@jiang-h-y

Copy link
Copy Markdown
Author

When I was smoke testing front end for FM users I noticed both dashboard and all pages are currently highlighted at the same time is that intended?

Image

FM dashboard just hasn't been merged yet, but ideally "All Pages" and "Dashboard" should link to different pages after it's merged

@jiang-h-y

Copy link
Copy Markdown
Author

To replace the [error, setError] useState pattern in foodManufacturerApplicationDetails.tsx and pantryApplicationDetails.tsx, I had to modify the alert hook. I separated this commit in case we want to make different design choices.

I also noticed during testing that you can edit pantry/FM applications so that the values for certain fields aren't the right type (e.g. setting "Zip/Postal Code" to a string). We might want to set some restrictions around that.

@dburkhart07 dburkhart07 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

lgtm pending decision on alert type

ERROR = 'error',
}

export enum AlertType {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Regarding the usage of this AlertType, why do we need this? I think we can just rely on the actual message to differentiate what the error is, and remove the typing altogether. Lmk if you have any other thoughts

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.

Should I remove the alert type field altogether or just the enum?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

i think both, i dont really see a use case for this unless you do.

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.

For switching between icons (e.g. line 221 for FM application details), should I case on the error message then?

I didn't really wanna do string matching though, so lmk if you have a better idea on how to switch between the icons.

@jxuistrying

Copy link
Copy Markdown

ok yea other than the frontend ui which is still waiting for FM to be merged otherwise everything else lgtm!

@jxuistrying jxuistrying left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

waiting for fm dashboard to be merged so lgtm!

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.

3 participants