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]: Endpoint to Retrieve a Single FAQ Inquiry #648

Open
6 tasks done
idehen-divine opened this issue Mar 2, 2025 · 0 comments
Open
6 tasks done

[FEAT]: Endpoint to Retrieve a Single FAQ Inquiry #648

idehen-divine opened this issue Mar 2, 2025 · 0 comments

Comments

@idehen-divine
Copy link

Description

Implement endpoints to allow users to retrieve a single FAQ inquiry.

Acceptance Criteria

GET /api/v1/faqs/{id}

  • It should be a PROTECTED endpoint requiring authentication.
  • It should return the requested FAQ inquiry if it exists.
  • It should return an appropriate error message if the inquiry is not found.

Purpose

To allow users to view a specific FAQ inquiry if needed.

Requirements

  • Develop server-side logic to retrieve FAQ inquiry based on the acceptance criteria.
  • Ensure proper validation of id before performing operations.
  • Implement authorization to ensure only the inquiry owner or an admin can delete it.
  • Write unit tests to confirm correctness and accuracy.

Expected Outcome

Users should be able to retrieve an FAQ inquiry by ID.

Tasks

  • Create GET endpoint /api/v1/faqs/{id} to fetch a single FAQ inquiry.
  • Validate id and ensure inquiry exists before retrieval.
  • Implement authorization checks to confirm requester has permission.
  • Write unit tests covering all scenarios.

Example Requests (With Auth Token)

GET Request

curl -X GET {rootdomain}/api/v1/faqs/{id} \
     -H "Authorization: Bearer YOUR_ACCESS_TOKEN"

Response (Success)

{
  "status_code": 200,
  "data": { "id": 1, "question": "Sample question?", "answer": "Sample answer." }
}

Response (Error - Not Found)

{
  "status_code": 404,
  "message": "FAQ Inquiry does not exist."
}

Testing

  • Write unit tests for retrieving FAQ inquiries.
  • Test for both successful and unsuccessful retrieval scenarios.
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

No branches or pull requests

1 participant