Skip to content

Mspca 7 activate deactivate account by ID - #232

Closed
pujitakalinadhabhotla wants to merge 21 commits into
mainfrom
MSPCA-7-activate-deactivate-account-by-id
Closed

pujitakalinadhabhotla wants to merge 21 commits into
mainfrom
MSPCA-7-activate-deactivate-account-by-id

Conversation

@pujitakalinadhabhotla

Copy link
Copy Markdown

ℹ️ Issue

Closes MSPCA-7

📝 Description

Adds PATCH /volunteers/:id/deactivate, PATCH /volunteers/:id/activate, PATCH /coordinators/:id/deactivate, and PATCH /coordinators/:id/activate, letting coordinators toggle a volunteer's or coordinator's active status by ID without deleting any of their data. An unknown ID returns a 404, and a non-numeric or non-positive ID returns a 400.

  1. Added VolunteersService.deactivate/activate and CoordinatorsService.deactivate/activate. Each looks up the record by ID, throws NotFoundException if it doesn't exist, and otherwise flips only the active field and saves — no other fields are touched and no rows are deleted.
  2. Added the four corresponding controller endpoints in VolunteersController and CoordinatorsController, using the existing validateId util to validate the ID before it reaches the service layer.
  3. Wrote service and controller tests for all four endpoints, covering the success path, the 404 path (record not found), the 400 path (invalid ID), and an explicit assertion that repo.delete is never called during deactivation.

✔️ Verification

yarn test volunteers coordinators: all new and existing volunteer/coordinator suites pass.

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