Skip to content

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

@idehen-divine

Description

@idehen-divine

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions