hngprojects / hng_boilerplate_python_fastapi_web

Apache License 2.0
153 stars 136 forks source link

[FEAT] Implement Endpoint to UPDATE About Page Content: settable from admin #107

Open thenoblet opened 3 months ago

thenoblet commented 3 months ago

Description

Implement an endpoint to UPDATE the content of the About page, allowing administrators to modify the information efficiently.


Purpose


Acceptance Criteria

Update About Page Content


Requirements

Update About Page Content


Expected Outcome


Checklist

  1. Update About Page Content

    • [x] Implement PUT /api/v1/content/about endpoint.
    • [x] Validate incoming content and handle errors effectively.
    • [x] Secure endpoint with authentication for administrators.
    • [x] Document endpoint, including request and response formats.

Testing

Documentation:


Endpoint

Description: Update the content of the About page.
Endpoint: PUT /api/v1/content/about
Authentication: Required
Authorization: Administrators only
Request Body:

{
    "title": "More Than Just A BoilerPlate",
    "introduction": "Welcome to Hng Boilerplate, where passion meets innovation.",
    "custom_sections": {
      "stats": {
        "years_in_business": 10,
        "customers": 75000,
        "monthly_blog_readers": 100000,
        "social_followers": 1200000
      },
      "services": {
        "title": "Trained to Give You The Best",
        "description": "Since our founding, Hng Boilerplate has been dedicated to constantly evolving to stay ahead of the curve."
      }
    }
}

Response (Success):

{
  "message": "About page content updated successfully.",
  "status_code": 200
}

Response (Error: Server Error):

{
  "message": "Failed to update About page content.",
  "status_code": 500
}

Response (Error: Unauthenticated):

{
  "message": "Invalid authentication credentials",
  "status_code": 401
}

Response (Error: Authenticated but Unauthorised):

{
  "message": "You do not have permission to perform this action.",
  "status_code": 403
}

Additional Notes:


Database Schema

Diagram

Link To Diagram

about page

Approved Issue

Link to approved issue: [FEAT] Implement Endpoint to UPDATE About Page Content: settable from admin

thenoblet commented 3 months ago

@markessien, @highb33kay, @buka4rill

An Afterthought (DB schema): Whilst implementing this, I realised it'd be cool to track which admin made changes to the content of the About Page. So, I'll need to extend the database schema and application logic to include user information for auditing purposes.

Is that something I can do, please? The DB and Auth guys are not really coming to through for us. Painful.