hngprojects / hng_boilerplate_nestjs

Description
Apache License 2.0
182 stars 105 forks source link

[FEAT] Blog Post Deletion Endpoint - Backend #108

Closed codeReaper0 closed 3 weeks ago

codeReaper0 commented 1 month ago

Description

Develop an endpoint to handle requests to delete a blog post where it is only open to super admin. If the data is deleted successfully, it will be returned to the client with a '202' status. If an error occurs, an appropriate error status will be returned.

Acceptance Criteria

Requirements

Expected Outcome

Endpoints

[DELETE] /api/v1/blogs/:id

Testing

Test Scenarios

  1. Successful Deletion of Blog Post

    • Ensure that the endpoint successfully deletes a blog post.
    • Confirm that the status code is 202.
  2. No Blog Post Found

    • Simulate a scenario where no blog posts are present in the database.
    • Confirm that the status code is 404.
    • Confirm that the response body contains an appropriate message.
  3. Insufficient Permission

    • Simulate a scenario where an ordinary user wants to access this endpoint.
    • Confirm that the status code is 403.
    • Confirm that the response body contains an appropriate message.
  4. Internal Server Error

    • Simulate an internal server error to raise an exception.
    • Verify that the endpoint returns a 500 Internal Server Error status code.
    • Confirm that the response body contains an appropriate error message.
  5. Invalid Id Parameters

    • Send requests with invalid id parameters (e.g., non existing obect Id).
    • Verify that the endpoint returns a 400 Bad Request status code.
    • Confirm that the response body contains an appropriate error message.
  6. Invalid Method

    • Send a request using an invalid HTTP method (e.g., POST) to the endpoint.
    • Verify that the endpoint returns a 405 Method Not Allowed status code.
markessien commented 1 month ago

only open for superadmin, and you should soft delete

buka4rill commented 1 month ago

@codeReaper0 who are your teammates?

codeReaper0 commented 1 month ago

codeReaper0 (Me)- FastAPI kunmifab - Laravel Iretoms - Go etanami - NestJS oluwashenor - .NET