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: Retrieve User Testimonials API #372

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

feat: Retrieve User Testimonials API #372

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

Comments

@Laban254
Copy link

Laban254 commented Feb 27, 2025

Description

Develop an API endpoint to retrieve all testimonials associated with a specific user.

Acceptance Criteria

  • Only authenticated users can access this endpoint.
  • The endpoint should be accessible at api/v1/testimonials/user/{user_id}.
  • The endpoint should accept HTTP GET requests.
  • Return appropriate response and status code.

Purpose

Delivers an API that retrieves all testimonials linked to a specific user.

Requirements

Data Validation:
The API should validate the request to ensure that the user_id is present and valid.

Expected Outcome

Successful retrieval of testimonials associated with the provided user_id.

Endpoint:

HTTP [GET] /api/v1/testimonials/user/{user_id}

API Request Example:

GET /api/v1/testimonials/user/{user_id}

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

API Successful Response

{
  "status": "success",
  "status_code": 200,
  "message": "User testimonials retrieved successfully",
  "data": [
    {
      "id": "string",
      "user_id": "string",
      "content": "string",
      "created_at": "string",
      "updated_at": "string"
    }
  ]
}

API Error Response

Bad Request

{
  "status": "error",
  "status_code": 400,
  "message": "Invalid request parameters",
  "error": "string"
}

Not Found

{
  "status": "error",
  "status_code": 404,
  "message": "User not found or no testimonials available",
  "error": "string"
}

Server Error

{
  "status": "error",
  "status_code": 500,
  "message": "Internal server error",
  "error": "string"
}

Tasks

  • Develop server-side logic to handle retrieving testimonials for a specific user.
  • Validate the incoming user_id parameter.
  • Ensure proper error handling for edge cases such as non-existing users or users with no testimonials.

Testing

  • Write unit tests for the testimonial retrieval logic.
  • Test various scenarios, including:
    • Retrieving testimonials for an existing user.
    • Trying with an invalid user_id.
@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