Open
Conversation
dburkhart07
requested changes
Mar 26, 2026
dburkhart07
left a comment
There was a problem hiding this comment.
some funny dsa adjustments! 🎱 🦀 📱 👑
| pantryId: number, | ||
| volunteerIds: number[], | ||
| addVolunteerIds: number[], | ||
| removeVolunteerIds: number[], |
There was a problem hiding this comment.
While we are on the topic of sets, on conversion, we should validate at the start that there are no duplicates within our respective lists (cant remove a volunteer twice and cant add one twice), and add a test for this.
| @@ -480,24 +495,32 @@ export class PantriesService { | |||
| } | |||
|
|
|||
| const users = await Promise.all( | |||
There was a problem hiding this comment.
Can we actually change this to use findBy({ id: In(allVolunteerIds) }) so that we only need to do one query select?
| throw new NotFoundException('One or more users not found'); | ||
| } | ||
|
|
||
| const nonVolunteers = users.filter((user) => user.role !== Role.VOLUNTEER); |
There was a problem hiding this comment.
We don't need to check that the volunteer users being removed are volunteers (we already know they are), so we can just check the ones being added.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
ℹ️ Issue
Closes SSF-171
📝 Description
pantries.controller.ts✔️ Verification
Checked with Postman that adding/removing worked and threw expected exceptions when needed. Verified written tests passed