Skip to content

feat: implement admin API endpoint to suspend users (#13)#63

Open
QueenColly wants to merge 1 commit into
SwiftChainn:mainfrom
QueenColly:feat/admin-suspend-user
Open

feat: implement admin API endpoint to suspend users (#13)#63
QueenColly wants to merge 1 commit into
SwiftChainn:mainfrom
QueenColly:feat/admin-suspend-user

Conversation

@QueenColly

Copy link
Copy Markdown

Closes #13

Summary of Work Done:
Implemented the administrative endpoint to suspend malicious users/drivers, strictly adhering to the requested Controller -> Service -> Model architecture.

Implementation Details:

Routing & Security (backend/src/routes/adminRoutes.ts): Registered PUT /api/v1/admin/users/:id/suspend and protected it using the existing Admin role middleware to ensure strict access control.

Controller (backend/src/controllers/adminController.ts): Handled parameter validation for the user ID and formatted the standard API response.

Service (backend/src/services/adminService.ts): Handled the business logic and database interaction, retrieving the target user via Mongoose and updating their status to suspended. Added robust error handling for scenarios where the user ID does not exist.

Environment & Integration: Connected to the live MongoDB database using the provided .env credentials. No mock data or hardcoded values were used.

@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

@QueenColly Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

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.

Backend: Implement Admin API endpoint to suspend/ban a malicious user or driver

1 participant