hngprojects / hng_boilerplate_nestjs

Description
Apache License 2.0
181 stars 105 forks source link

Implement Endpoints for CRUD Operations of FAQ #170

Closed Horlarhyinka closed 2 months ago

Horlarhyinka commented 3 months ago

Description

Develop API endpoints to handle CRUD (Create, Read, Update, Delete) operations for Frequently Asked Questions (FAQs). This will allow admins to manage FAQ entries through the backend.

Purpose

To provide admins with the ability to manage FAQ entries efficiently, improving the overall user experience by keeping the FAQ section up-to-date.

Requirements

Expected Outcome

The backend should handle CRUD operations for FAQ entries efficiently and log responses and errors properly.

Endpoints

  1. Create FAQ Entry:

    • Endpoint: HTTP POST /api/v1/faqs
    • Request Body:
      {
      "question": "String",
      "answer": "String",
      "category": "String"
      }
    • Response (Success):
      {
      "id": "String",
      "question": "String",
      "answer": "String",
      "category": "String"
      }
    • Response (Error - Invalid Request):
      {
      "message": "Invalid request data",
      "status_code": 400
      }
    • Response (Authorization Error):
      {
      "message": "Unauthorized access",
      "status_code": 403
      }
  2. Read FAQ Entries:

    • Endpoint: HTTP GET /api/v1/faqs
    • Response (Success):
      [
      {
       "id": "String",
       "question": "String",
       "answer": "String",
       "category": "String"
      }
      ]
    • Response (Error - Invalid Request):
      {
      "message": "Invalid request",
      "status_code": 400
      }
  3. Update FAQ Entry:

    • Endpoint: HTTP PUT /api/v1/faqs/{id}
    • Request Body:
      {
      "question": "String",
      "answer": "String",
      "category": "String"
      }
    • Response (Success):
      {
      "id": "String",
      "question": "String",
      "answer": "String",
      "category": "String"
      }
    • Response (Error - Invalid Request):
      {
      "message": "Invalid request data",
      "status_code": 400
      }
    • Response (Authorization Error):
      {
      "message": "Unauthorized access",
      "status_code": 403
      }
  4. Delete FAQ Entry:

    • Endpoint: HTTP DELETE /api/v1/faqs/{id}
    • Response (Success):
      {
      "message": "FAQ entry deleted successfully"
      }
    • Response (Error - Invalid Request):
      {
      "message": "Invalid request",
      "status_code": 400
      }
    • Response (Authorization Error):
      {
      "message": "Unauthorized access",
      "status_code": 403
      }

Acceptance Criteria

markessien commented 3 months ago

This is not a supported feature

Shullyd7 commented 3 months ago

Specify the errors and their status_code

Shullyd7 commented 3 months ago

You have to specify the error message that required that status_code