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] : Blog Post Editing #48

Open
8 tasks
Lftobs opened this issue Jul 18, 2024 · 0 comments
Open
8 tasks

[FEAT] : Blog Post Editing #48

Lftobs opened this issue Jul 18, 2024 · 0 comments
Assignees
Labels
blog Issues categorised by blog

Comments

@Lftobs
Copy link
Contributor

Lftobs commented Jul 18, 2024

Description

Create an API endpoint to allow super admin handle editing existing blog posts. This endpoint will validate the input data and update the blog post securely in the database

Acceptance Criteria

  • The endpoint allows only a super admin to edit an existing blog post.
  • The endpoint should be accessible at /api/v1/blog/edit/{blog_id}
  • The endpoint should accept HTTP PUT requests.
  • The API should validate the request payload to ensure the title and other necessary fields is provided.
  • Upon successful validation of the input data, the blog post should be updated in the database securely.
  • Return a 200 OK status code on successful request.

Request body application/json

{
  "title": "string",
  "excerpt": "string",
  "tags": ["string"]
}

Success payload

{ 
  "message": "Blog successfully updated",
  "id": "int",
  "title": "string",
  "excerpt": "string",
  "updated_at": "Datatime"
}

Error payload

{
  "message": "Unauthorized request",
  "status_code": 401
}

Purpose

Provide the necessary backend services to allow super admin to edit and update their previously published blog posts.

Requirements

  • Implement server-side logic to handle blog post edit submissions.
  • Validate and sanitize incoming data.
  • Update the blog post securely in the database.
  • A 401 error should be sent if an unauthorized user tries to edit a blog

Expected Outcome

The API endpoint allows super admin to edit their blog posts via the provided data, ensuring all updates are securely stored and validated.

Test

  • Write unit tests to ensure the blog post edit endpoint validates input correctly and updates the post securely.
  • Test various scenarios for editing blog posts (e.g., missing title, empty content, invalid tags).
  • Perform security test to ensure unauthorized user can not update a blog post.
  • Test various scenarios:
    • Successful editing of an existing blog post
    • Attempting to edit a non existing blog post
    • Attempting to edit a blog post without authentication
    • Attempting to edit a blog post without proper permissions
@Lftobs Lftobs self-assigned this Jul 18, 2024
@Laban254 Laban254 added the blog Issues categorised by blog label Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blog Issues categorised by blog
Projects
None yet
Development

No branches or pull requests

2 participants