Skip to content

Conversation

@YashK2005
Copy link
Collaborator

@YashK2005 YashK2005 commented Oct 15, 2025

Notion ticket link

Participant Dashboard

Implementation description

This PR implements the complete backend API surface for the participant dashboard match management system,
enabling participants to view, schedule, cancel, and request changes to their volunteer matches.

Core Features

1. Match Status System (commits 987986a, 587ab2a)

  • Standardized match lifecycle with 9 statuses: pending, confirmed, cancelled_by_participant,
    cancelled_by_volunteer, completed, requesting_new_times, requesting_new_volunteers, rescheduled,
    no_show
  • Updated form status workflow: volunteers move to secondary_application_todo after submitting secondary
    application

2. Admin Match Management APIs (commit 8f33eff)

  • POST /matches/ - Create matches between participants and volunteers
  • PUT /matches/{match_id} - Update match details (volunteer assignment, status, chosen time)
  • GET /matches/participant/{participant_id} - View all matches for a specific participant (admin only)
  • Automatically copies volunteer availability as suggested times when creating matches
  • Filters out past time blocks and invalid time ranges

3. Participant Match APIs (commits 8f33eff, 9a5723b)

  • GET /matches/me - View all my matches with volunteer info and suggested times
  • POST /matches/{match_id}/schedule - Select a time slot and confirm the match
    • Sets status to confirmed
    • Stores chosen time block
    • Automatically deletes other pending matches (enforces one-active-match rule)
  • POST /matches/{match_id}/request-new-times - Request alternative meeting times
    • Clears existing suggested times
    • Accepts 1-3 new time ranges
    • Generates 30-minute blocks from provided ranges
    • Updates status to requesting_new_times

4. Cancellation Workflows (commit da85902)

  • POST /matches/{match_id}/cancel - Participant cancels their match
    • Updates status to cancelled_by_participant
    • Clears chosen time block
    • Authorization: participant must own the match (admin can bypass)
  • POST /matches/{match_id}/cancel-volunteer - Volunteer/admin cancels match
    • Updates status to cancelled_by_volunteer
    • Authorization: volunteer must own the match or be admin

5. Request New Volunteers (commit da85902)

  • POST /matches/request-new-volunteers - Participant requests different volunteer matches
    • Deletes all existing matches for participant
    • Optionally creates a matching task for admin with participant's message
    • Returns count of deleted matches
    • Authorization: participant owns request (admin can act on behalf)

6. Time Block Validation & Consistency (commits 9a5723b, 85f98f6)

  • Updated TimeRange schema validation:
    • Enforces half-hour boundaries (:00 or :30 only)
    • Requires minimum 30-minute duration
    • No seconds or microseconds allowed
    • End time must be after start time
  • All time block generation now creates 30-minute slots on half-hour boundaries
  • Fixed inconsistency where blocks were generated every 15 minutes

7. Code Cleanup (commit e423a8f)

  • Removed legacy /matches/confirm-time endpoint (unsecured, duplicated functionality)
  • Removed unused schemas: SubmitMatchRequest, SubmitMatchResponse
  • Removed submit_time() service method
  • Ran linting on backend codebase

8. Comprehensive Testing (commits fc514c4, c6276d6)

  • 63 new tests (19 TimeRange validation + 44 Match service integration tests)
  • tests/unit/test_time_block_validation.py - Pure schema validation tests (no database)
  • tests/unit/test_match_service.py - Full integration tests covering all match endpoints
    • Create, read, schedule, cancel, update operations
    • Authorization checks (participant ownership, admin bypass)
    • Edge cases and error handling
  • Easy test setup via pdm run test-setup command
  • PostgreSQL test database for consistency with production
  • Updated README with testing documentation
  • Added *.db to .gitignore

API Surface Summary

Admin Endpoints (3):

  • POST /matches/ - Create matches
  • PUT /matches/{match_id} - Update match
  • GET /matches/participant/{participant_id} - View participant's matches

Participant Endpoints (5):

  • GET /matches/me - View my matches
  • POST /matches/{match_id}/schedule - Schedule a call
  • POST /matches/{match_id}/request-new-times - Request alternate times
  • POST /matches/{match_id}/cancel - Cancel my match
  • POST /matches/request-new-volunteers - Request new volunteers

Volunteer Endpoints (1):

  • POST /matches/{match_id}/cancel-volunteer - Cancel as volunteer

Next steps: Frontend of Participant Dash

Steps to test

What should reviewers focus on?

Checklist

  • My PR name is descriptive and in imperative tense
  • My commit messages are descriptive and in imperative tense. My commits are atomic and trivial commits are squashed or fixup'd into non-trivial commits
  • I have run the appropriate linter(s)
  • I have requested a review from the PL, as well as other devs who have background knowledge on this PR or who will be building on top of this PR

@YashK2005
Copy link
Collaborator Author

@codex review

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

@YashK2005
Copy link
Collaborator Author

@codex review again

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

@YashK2005
Copy link
Collaborator Author

@codex review again

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

@YashK2005
Copy link
Collaborator Author

@codex review

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Delightful!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

- Matches default to awaiting_volunteer_acceptance status
- Volunteers must accept matches before participants can see them
- Add GET /matches/volunteer/me and POST /matches/{id}/accept-volunteer endpoints
- Validate volunteers have availability before accepting matches
- Add pending_volunteer_request field to track participant requests
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