Skip to main content

Reactivate disabled user (Admin only)

POST 

/company/users/disabled/reactivate/:id

Reactivates a disabled user (restores from soft delete), allowing them to access the platform again.

Objective

Allow administrators to reactivate users who were disabled via soft delete, restoring their full access.

Use Cases

  • Reactivate an employee returning to the company
  • Restore access disabled by mistake
  • Reactivate a user after completing verification

Authentication & Authorization

  • Requires a valid JWT (middleware m.isloged)
  • Requires admin or dev role (middleware m.isAdmin)

Behavior

  • Searches for a user using model.findOneDeleted()
  • Restores using user.restore() from mongoose-delete
  • Resets status: status = true, reason = NONE
  • Clears reasonDate and reasonMessage
  • Sets message: User reactivated from disabled status

Process Flow

  1. Searches for a disabled user by ID
  2. If not found, returns 404
  3. Executes user.restore() to revert soft delete
  4. Sets status = true
  5. Resets reason = NONE
  6. Clears reasonDate and reasonMessage
  7. Saves changes
  8. Returns the reactivated user

Notes

  • This endpoint restores users deleted via soft delete
  • Different from POST /status/:id which only changes the status
  • Fully recovers the user (removes the deleted flag)

Request

Responses

User successfully reactivated