Open Danmwihoti opened 3 months ago
Create API endpoints for managing teams (rename, delete, archive, activate, deactivate).
Allow admins to manage teams through various actions. Provide API endpoints for managing teams.
Define API endpoints and request schemas for:
Implement logic to perform these management actions. Handle success and error responses for each action. Write tests for each endpoint.
/api/v1/teams/{teamId}/rename
Renames the team with the specified ID.
{ "newName": "string" }
Status code: 200
{ "message": "Team renamed successfully.", "teamId": 123, "newName": "New Team Name" }
Status code: 400
{ "error": "Bad Request", "message": "Invalid name provided." }
Status code: 404
{ "error": "Not Found", "message": "Team not found." }
[DELETE] /api/v1/teams/{teamId} Delete the team with the specified ID.
Status code: 204 Deleted successfully
Status code: 403
{ "error": "Forbidden", "message": "You do not have permission to delete this team." }
[PATCH] /api/v1/teams/{teamId}/archive It Archives the team with the specified ID.
{ "message": "Team archived successfully.", "teamId": 123 }
{ "error": "Forbidden", "message": "You do not have permission to archive this team." }
[PATCH] /api/v1/teams/{teamId}/activate Activates the team with the specified ID.
{ "message": "Team activated successfully.", "teamId": 123 }
[PATCH] /api/v1/teams/{teamId}/deactivate
Deactivate the team with the specified ID.
{ "message": "Team deactivated successfully.", "teamId": 123 }
Authentication & Authorization:
Unit Tests:
@mwihoti
Description
Create API endpoints for managing teams (rename, delete, archive, activate, deactivate).
Acceptance Criteria
Allow admins to manage teams through various actions. Provide API endpoints for managing teams.
Tasks
Define API endpoints and request schemas for:
Implement logic to perform these management actions. Handle success and error responses for each action. Write tests for each endpoint.
1. Rename Team
Endpoints
/api/v1/teams/{teamId}/rename
Renames the team with the specified ID.
Request Body
Responses
Successful
Status code: 200
Error Response
Status code: 400
Status code: 404
2. Deleting teams
Endpoints
[DELETE] /api/v1/teams/{teamId} Delete the team with the specified ID.
Responses
Successful
Status code: 204 Deleted successfully
Error Response
Status code: 403
Status code: 404
3. Archive Team
Endpoints
[PATCH] /api/v1/teams/{teamId}/archive It Archives the team with the specified ID.
Responses
Successful
Status code: 200
Error Response
Status code: 403
Status code: 404
4. Activate team
Endpoints
[PATCH] /api/v1/teams/{teamId}/activate Activates the team with the specified ID.
Responses
Successful
Status code: 200
Error Response
Status code: 403
Status code: 404
5. Deactivate Team
Endpoints
[PATCH] /api/v1/teams/{teamId}/deactivate
Deactivate the team with the specified ID.
Responses
Successful
Status code: 200
Error Response
Status code: 403
Status code: 404
Secure Endpoints
Authentication & Authorization:
Write Tests
Unit Tests: