Skip to content

MSPCA-56 Add pets and household details to foster volunteers - #34

Merged
dburkhart07 merged 12 commits into
mainfrom
jw/mspca-56-volunteer-pets
Nov 22, 2026
Merged

dburkhart07 merged 12 commits into
mainfrom
jw/mspca-56-volunteer-pets

Conversation

@Juwang110

@Juwang110 Juwang110 commented Nov 12, 2026 •

Copy link
Copy Markdown

ℹ️ Issue

Closes MSPCA-56

📝 Description

residentAnimals was free text, so coordinators couldn't tell which animals already live in a volunteer's home. Volunteers now have a structured list of pets, plus whether they have children (and their ages) and whether they have a separate room for a foster animal.

  1. New pets table: age in years and months (0–11), species (FosterType) and breed, linked to the volunteer with ON DELETE CASCADE. No controller, service or module.
  2. Volunteer columns: has_children and has_separate_foster_room (both required) and children_ages int[]. resident_animals is dropped.
  3. Children rule, both ways: hasChildren: true needs at least one age, and false needs none. A database CHECK enforces it, and the service checks it first so a bad request gets a 400 instead of a 500.
  4. POST /volunteers, PATCH /volunteers/:id and coordinator-update-profile accept the new fields. On create, childrenAges and pets default to []. Sending pets replaces the whole list, and leaving it out keeps the current pets. Every volunteer endpoint returns pets.

✔️ Verification

  • Service tests cover a volunteer with pets, without pets and with children, replacing pets, and each way an update can break the children rule. A controller test runs the real ValidationPipe to check nested pets survive whitelist. All 441 backend tests pass, and lint and typecheck are clean.
  • I ran the migration up → down → up against local Postgres. Existing rows get false and {}.
  • Against local Postgres: the children constraint, negative ages and age_month = 12 are rejected, deleting a volunteer removes their pets, and saving one pet over two leaves exactly one row.

🏕️ (Optional) Future Work / Notes

🤖 Generated with Claude Code

Juwang110 and others added 6 commits November 12, 2026 17:47
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…s when hasChildren is turned off

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ns them

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tion comments

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Juwang110
Juwang110 marked this pull request as ready for review November 14, 2026 18:46
@dburkhart07 dburkhart07 self-assigned this Nov 16, 2026

@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.

a lot of small things but looks amazing so far. such a clean PR for so many edge cases. tests are all well-written as well. 10x dev fr

Juwang110 and others added 2 commits November 17, 2026 18:53
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Move PetDto to pets/dtos, document params on the children-rule helpers,
and type the pet fixtures in specs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

@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.

super clean PR, rest of the comments are small. thank you Justin!!!! 🐟

Juwang110 and others added 2 commits November 22, 2026 10:09
…-pets

# Conflicts:
#	apps/backend/src/volunteers/volunteers.entity.ts
#	apps/backend/src/volunteers/volunteers.service.spec.ts
#	apps/backend/src/volunteers/volunteers.service.ts
Combine the create() InternalServerErrorException @throws, use real
coordinator and pet data in the findByIdOrFail test, cast the pet
fixtures, drop the livelyNeighborhood update test, and assert the old
pet is left out of the saved list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@psmolyan psmolyan 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.

looks great, had some concerns abt hasChildren but i snooped through ur old replies to comments and makes sense!

@dburkhart07
dburkhart07 merged commit 4b04f70 into main Nov 22, 2026
12 checks passed
@dburkhart07
dburkhart07 deleted the jw/mspca-56-volunteer-pets branch November 22, 2026 21:56
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.

4 participants