Skip to content

MSPCA-10 Add GET /volunteers/:id/matches endpoint - #5

Merged
Juwang110 merged 11 commits into
mainfrom
jw/mspca-10-volunteer-matches-endpoint
Oct 3, 2026
Merged

Juwang110 merged 11 commits into
mainfrom
jw/mspca-10-volunteer-matches-endpoint

Conversation

@Juwang110

@Juwang110 Juwang110 commented Sep 27, 2026 •

Copy link
Copy Markdown

ℹ️ Issue

Closes MSPCA-10

📝 Description

Adds GET /api/volunteers/:volunteerId/matches, which returns every match for a volunteer with matchId, chameleonAnimalId, status, and deniedReason. A volunteer with no matches gets [] with a 200. An unknown volunteer gets a 404, and a non-numeric or non-positive id gets a 400.

Changes:

  1. Added MatchesService.findByVolunteerId and VolunteersService.existsById. existsById is identical to the one in MSPCA-11 Add POST /recommendations endpoint #4, so the two PRs merge cleanly there. The 404 depends on whether the volunteer exists, not on whether the result is empty, which keeps "no matches" a 200.
  2. VolunteersModule imports MatchesModule and CoordinatorsModule, and is now registered in AppModule. Before this, no feature module was mounted, so the route would never have been served.
  3. Fixed PluralNamingStrategy.columnName, which ignored @Column({ name }). Every named column was queried by its camelCase property name ("volunteerId" rather than volunteer_id), so any query against a real DB returned a 500. This affects every entity. The same commit is on MSPCA-11 Add POST /recommendations endpoint #4.

✔️ Verification

  • yarn test: all backend suites pass (20 suites, 154 tests), including new service and controller tests.
  • yarn lint:check and yarn format:check are clean.
  • Against a local Postgres with migrations applied, start npx nx serve backend and run:
    curl -i localhost:3000/api/volunteers/<id>/matches
    A volunteer with matches returned 200 with the matches, and one without returned 200 with []. An unknown id returned 404 and abc returned 400.

🏕️ (Optional) Future Work / Notes

justin-wang110 and others added 7 commits September 27, 2026 13:57
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Juwang110
Juwang110 force-pushed the jw/mspca-10-volunteer-matches-endpoint branch from f115399 to 99c6b35 Compare September 27, 2026 17:58
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@Juwang110
Juwang110 marked this pull request as ready for review September 27, 2026 18:00

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

just a few smalls. Some general formatting and logic things that I pointed out in your other PR apply here too. Can you make sure those changes are reflected in this one as well?

Comment thread apps/backend/src/volunteers/volunteers.controller.ts Outdated
Comment thread apps/backend/src/volunteers/volunteers.service.spec.ts Outdated
Comment thread apps/backend/src/volunteers/volunteers.controller.spec.ts Outdated
Co-Authored-By: Claude Opus 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.

both things are very small so ill approve! thanks justin!!

Comment thread apps/backend/src/matches/matches.service.spec.ts Outdated
Comment thread apps/backend/src/matches/matches.service.spec.ts

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

could we also document all service functions using the following docstring format:

  • Summary line describing the function
  • Additional context about behavior or edge cases
  • @PARAM tags for parameters
  • @return tags for return value
  • @throw tags for any exceptions they throw

Juwang110 and others added 2 commits October 1, 2026 22:11
- Hoist the matches fixture in MatchesService tests so later tests can
  reuse it
- Assert repo.find is called in the empty-result findByVolunteerId test
- Document MatchesService.findByVolunteerId and
  VolunteersService.findByIdOrFail with summary, context, @PARAM,
  @returns and @throws

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Juwang110
Juwang110 merged commit 356ebad into main Oct 3, 2026
10 checks passed
@Juwang110
Juwang110 deleted the jw/mspca-10-volunteer-matches-endpoint branch October 3, 2026 14:55
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