Skip to content

Pantry volunteer management #31

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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Conversation

Juwang110
Copy link

@Juwang110 Juwang110 commented Mar 5, 2025

ℹ️ Issue

Closes changing volunteer type for pantry volunteer assignments and serving as a hub to navigate to adding volunteers or viewing assigned pantries for each volunteer.

📝 Description

I added a volunteer management page which displays each volunteer (that's assigned to a pantry) with a column for the volunteer name, a column for assigned pantries, and a column for volunteer type. The column for assigned pantries is simply a button for each row that navigates to a nonexistent page but it would house all the pantries assigned with this volunteer. The column for volunteer type is a dropdown that allows an admin to update the type. There is a button to reset unsaved changes and a button to save current changes made in the table (volunteer type is consistent across pantry assignments so when volunteer type is changed for one user, all assignments of that user change to that new volunteer type). An add new volunteer button is also present that navigates to a nonexistent page which would allow addition/deletion of volunteers entirely. The page finally includes a search bar filter to search by name and a volunteer type checkbox filter. This page is important because it allows admins to change a volunteer's type, or navigate to add/delete volunteers, or navigate to manage a volunteer's pantries.

Briefly list the changes made to the code:

  1. Added volunteer management page with ability to change volunteer type on backend
  2. Backend support for assignments table
  3. Volunteer type enum and new volunteer type column in assignments table

✔️ Verification

To verify my new feature worked I had to manually create a pantry and a user in PGAdmin and I added rows to the assignments table assigning users as volunteers to pantries. I then made sure saving changes to volunteer type altered every row in the assignments table with that volunteer id. I also played around to make sure the filters on the page worked just by simply changing inputs.

Screenshot 2025-03-04 194202
Screenshot 2025-03-04 194141

🏕️ (Optional) Future Work / Notes

Notes:

  • RUN NEW MIGRATION to make sure your database is up to date
  • Me and Fanny discussed some higher level issues with the ticket so this PR doesn't fully correspond with the ticket I got in Trello, I made some edit notes on that ticket as well.
  • Add new volunteer goes to unexisting route
  • View assigned pantries goes to unexisting route but it includes the volunteer_id in the url to be used to filter pantries to only ones for this volunteer

controllers: [AssignmentsController],
providers: [AssignmentsService, AuthService, JwtStrategy],
})
export class AssignemntsModule {}
Copy link

@fanzzz368 fanzzz368 Mar 24, 2025

Choose a reason for hiding this comment

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

typo for assignmentsModule (assignemnts instead of assignments)


@Put(':id/role')
async updateRole(@Param('id') id: number, @Body('role') role: string) {
const upperCaseRole = role.toUpperCase();

Choose a reason for hiding this comment

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

we can just leave the updated role as lowercase in the backend so we can get rid of upperCaseRole here

<Tbody>
{filteredAssignments?.map((assignment) => (
<Tr key={assignment.assignmentId}>
<Td>{assignment.volunteer.firstName}</Td>

Choose a reason for hiding this comment

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

maybe it would be good to include both the volunteer's first and last name on this line

)
}
>
{volunteerType}

Choose a reason for hiding this comment

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

Here the volunteerType is shown as what we have in the backend (lowercase with _) but we probably want to display it differently in the frontend; we could do something like

const VOLUNTEER_TYPES: Record<string, string> = {
LEAD_VOLUNTEER: 'Lead Volunteer',
STANDARD_VOLUNTEER: 'Standard Volunteer',
NON_PANTRY_VOLUNTEER: 'Non-Pantry Volunteer',
};

and then here, we would do {VOLUNTEER_TYPES[volunteerType.toUpperCase()] || volunteerType} instead of {volunteerType}

</option>
<option value={VolunteerType.NON_PANTRY_VOLUNTEER}>
Non-Pantry Volunteer
</option>

Choose a reason for hiding this comment

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

if we decide to go with const VOLUNTEER_TYPES from below, we can replace lines 102-108 with {Object.entries(VOLUNTEER_TYPES).map(([value, label]) => (

{label}

))}

so we can stay consistent with the formatting

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