Skip to content

feat: implement volunteer availability and assignment matching#175

Merged
AlperKartkaya merged 1 commit into
developmentfrom
backend/availability-setup
Mar 29, 2026
Merged

feat: implement volunteer availability and assignment matching#175
AlperKartkaya merged 1 commit into
developmentfrom
backend/availability-setup

Conversation

@berat-sayin

@berat-sayin berat-sayin commented Mar 29, 2026

Copy link
Copy Markdown
Contributor

Description

This PR implements the backend infrastructure for the Volunteer Availability module and the Matching/Assignment flow for the MVP. It
allows volunteers to declare their availability and automatically pairs them with pending help requests based on matching criteria.

Key Features

  • Availability Toggle: New endpoint to turn availability on/off with optional GPS coordinate updates.
  • Offline Sync: Support for syncing a batch of availability records from mobile devices that were previously offline.
  • Automated Matching: Simple deterministic logic that matches an available volunteer with the oldest pending help_request that fits their
    need_types.
  • Assignment Management: Volunteers can view their current assignment, mark it as resolved, or cancel it.
  • Re-evaluation Flow: If an assignment is cancelled, the request is put back into the PENDING pool, and the volunteer is immediately
    searched for a new matching task.

Technical Changes

  • Module Structure: Created repository.js, service.js, controller.js, and validators.js within backend/src/modules/availability.
  • Database Integration: Utilizes volunteers, availability_records, and assignments tables.
  • Routing: Mounted the availabilityRouter in the main API router under /api/availability.
  • Security: All endpoints are protected by the existing requireAuth middleware.

New Endpoints

  • POST /api/availability/toggle: Update current availability.
  • POST /api/availability/sync: Sync offline history.
  • GET /api/availability/my-assignment: View active task.
  • POST /api/availability/assignments/:id/cancel: Drop current task.
  • POST /api/availability/assignments/resolve: Mark task as completed.

Related to the issue #90 and its sub-issues #113, #114, #116, #118, #119.

@AlperKartkaya AlperKartkaya left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems quite alright, if anything goes wrong we can check later on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants