Skip to content

[SSF-169] backend logic to return required actions for FM#140

Open
amywng wants to merge 2 commits intomainfrom
acw/SSF-169-FM-required-actions-be
Open

[SSF-169] backend logic to return required actions for FM#140
amywng wants to merge 2 commits intomainfrom
acw/SSF-169-FM-required-actions-be

Conversation

@amywng
Copy link
Copy Markdown
Member

@amywng amywng commented Mar 27, 2026

ℹ️ Issue

Closes SSF-169

📝 Description

  • updated getFMDonations in `manufacturers.service.ts
    • to take in current request user id and check that it matches the manufacturer representative id
    • return only matched donations
    • for each donation, return associated pending orders (where orders have at least one allocation tied to a donation item from the donation
    • for each donation, return relevant donation items (that are used in any associated order and detailsConfirmed is false)
  • added DonationDetailsDto for return type
  • updated controller and service tests

✔️ Verification

verified tests pass and tested call in postman

Copy link
Copy Markdown

@Juwang110 Juwang110 left a comment

Choose a reason for hiding this comment

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

Minor things but looks great!

@amywng amywng requested a review from Juwang110 March 28, 2026 13:36
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.

coolington~

one design note included about keeping previous implementation logic (donations of all statuses) & then adding the matched logic

  • jest tests
  • postman tested

foodManufacturerId,
})
.andWhere(`donation.status = :status`, {
status: DonationStatus.MATCHED,
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 need to return a FM's donations -all statuses- for this page and also get complete required actions for only matched donations, so i'd suggest filtering for matched & returning the hefty payload

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.

design choice of:

  • 2 endpoints (all status donations + all matched donations) - separation of concerns & conditionally controlling lighter vs heavier payload BUT frontend has to manage 2 endpoints
  • 1 endpoint + conditional rendering for matched donations: one main endpoint BUT more service logic & heavier payload

leaning towards the 1 endpoint since this page with donations statuses will be frequently changing. lmk your thoughts!

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