Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: API Endpoint to delete a testimonial #373

Open
11 tasks
Laban254 opened this issue Feb 27, 2025 · 1 comment
Open
11 tasks

feat: API Endpoint to delete a testimonial #373

Laban254 opened this issue Feb 27, 2025 · 1 comment
Assignees

Comments

@Laban254
Copy link

Description

Develop an api endpoint to handle the deletion of a testimonial. This api will validate the testimonial_id

Acceptance Criteria

  • Only authenticated users with admin permisssions can delete testimonials.

  • The endpoint should be accessible at api/v1/testimonials/:testimonial_id

  • The endpoint should accept HTTP DELETE requests.

  • The endpoint should be protected and require authentication

  • Request to the endpoint should include a valid authentication token in Authorization header . Authorization: Bearer <token>

  • Return appropriate response and status code

Purpose

Delivers a api that manages testimonial deletion and verifies the validity of the testimonial ID.

Requirements

Data Validation:
The api should validate the request to ensure that the testimonial id is present and valid

Expected Outcome

Successful deletion of testimonial with selected testimonial id.

Endpoint:

HTTP [DELETE] /api/v1/testimonials/:testimonial_id

API Request Example:

DELETE /api/v1/testimonials/:testimonial_id

{
  "Content-Type": "application/json",
  "Authorization": "Bearer <token>"
}

API Successful Response

{
  "success": true,
  "message": "string",
  "status_code": 200
}

API Error Response

Bad request

{
  "message": "string",
  "error": "string",
  "status_code": 400
}

Unauthorized

{
  "message": "string",
  "error": "string",
  "status_code": 401
}

Not Found

{
  "message": "string",
  "error": "string",
  "status_code": 404
}

Server Error

{
  "message": "string",
  "error": "string",
  "status_code": 500
}

Tasks

  • Develop server-side logic to handle testimonial deletion requests.

  • Validate incoming testimonial ID data.

  • Validate the user deleting the testimonial is an admin.

Testing

  • Write unit tests for the delete testimonial logic.

  • Test various scenarios such as deleting existing testimonials, attempt without authentication or proper permissions, deleting

@Laban254
Copy link
Author

slack ID: @kibe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants