Skip to content

MSPCA-24: Add animal-updates opt-in endpoint and make fosterType a list - #11

Open
psmolyan wants to merge 3 commits into
jw/mspca-20-create-volunteer-endpointfrom
ps/mspca-24-animal-updates-endpoint
Open

psmolyan wants to merge 3 commits into
jw/mspca-20-create-volunteer-endpointfrom
ps/mspca-24-animal-updates-endpoint

Conversation

@psmolyan

@psmolyan psmolyan commented Oct 9, 2026 •

Copy link
Copy Markdown

ℹ️ Issue
Closes MSPCA-24

Stacked on #8 (MSPCA-20). Merge #8 first, then retarget this to main

📝 Description
Lets foster volunteers opt in or out of hearing what happens to an animal after it returns to MSPCA, and changes foster_type from a single value to a list

Changes:

  • New animal_updates boolean column on foster_volunteers (default true), with a migration
  • foster_type is now an array of foster_type_enum; the same migration converts existing values to single-item lists (USING ARRAY["foster_type"])
  • New endpoint PATCH /api/volunteers/:id/animal-updates with UpdateAnimalUpdatesDto
    • 404 if the volunteer doesn't exist
    • 400 for a malformed ID or a missing/non-boolean body
  • CreateVolunteerDto.fosterType is now FosterType[]; an empty list is rejected
  • Updated existing volunteer specs for the list-shaped fosterType
  • Service, controller, and DTO validation tests

✔️ Verification
Ran the full backend suite: 22 suites, 250 tests pass. Ran the migration against local Postgres and confirmed in pgAdmin that animal_updates is boolean with default true and foster_type is foster_type_enum[]. The single-value-to-array conversion was not run on real data, since my local database had no volunteer rows

🏕️ (Optional) Future Work / Notes

  • down keeps only the first foster type per volunteer.
  • config/migrations.ts may conflict with the coordinator migration (MSPCA-19), keep both entries

@dburkhart07 dburkhart07 left a comment

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.

upon talking with the client yesterday, i think the scope of this ticket may have changed slightly. volunteers will now likely change their animalUpdates preferences in the same space as the rest of their profile. because of this, rather having an entirely separate endpoint, i think we can just have it be an additional field within the update-volunteer.dto.ts file (this should be in the main branch, you just need to merge the changes in). do you think you could refactor it to this instead, and make sure the already established update volunteer endpoint works with the new boolean field?

import { FosterType } from '../volunteers.types';
import { Homebase } from '../../types';

const validBody = {

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 normally don't write test files for our dtos. this is because we are relying under the assumption that our validators work and will make sure we have valid inputs. our class-validators are coming from nestjs, which we assume already works.

because of this, do you think we could delete the two spec files here?

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