Skip to content

fix: Auto-assign when new help request created#220

Merged
mehmetcangurbuz08 merged 1 commit into
mainfrom
fix/auto-assign
Apr 6, 2026
Merged

fix: Auto-assign when new help request created#220
mehmetcangurbuz08 merged 1 commit into
mainfrom
fix/auto-assign

Conversation

@berat-sayin

@berat-sayin berat-sayin commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Related to #225

Changes:

  • backend/src/modules/availability/repository.js: Added findMatchingVolunteerForRequest to find an
    available volunteer who doesn't have an active assignment and matches the request's need type.
  • backend/src/modules/availability/service.js: Added and exported tryToAssignRequest to encapsulate the
    assignment logic (creating an assignment record and updating the request status to ASSIGNED).
  • backend/src/modules/help-requests/service.js: Updated createMyHelpRequest to call tryToAssignRequest
    immediately after a request is successfully created. It now returns the updated request (which will
    have MATCHED status if a volunteer was found).
  • Tests:
    • Added a new integration test case in
      backend/tests/integration/modules/help-requests/help-requests.integration.test.js to verify that a
      new request is auto-assigned to an already available volunteer.
    • Updated unit tests in both availability and help-requests modules to reflect the new functionality
      and ensure correct mocking.

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

Looks solid. Merging.

@mehmetcangurbuz08
mehmetcangurbuz08 merged commit 858a2a9 into main Apr 6, 2026
2 checks passed
@mehmetcangurbuz08
mehmetcangurbuz08 deleted the fix/auto-assign branch April 6, 2026 22:03
@berat-sayin berat-sayin added bug Something isn't working backend labels Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backend bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants