Skip to content

BE-5: DELETE Book Record #5

@tecnodeveloper

Description

@tecnodeveloper

Implement an endpoint to delete a book record by ID.

User Story

Given a book exists
When I request deletion
Then the book should be removed from the database

Endpoint

DELETE /book/:id

Tasks

  • Create DELETE /book/:id route

  • Validate id param

  • Check if book exists

    • Return 404 Not Found if not
  • Delete record from DB

  • Return success response

  • Add Swagger documentation

    • Define path param
    • Add responses (200, 404)

Acceptance Criteria

  • Valid ID deletes the book
  • Non-existent ID returns 404
  • Invalid ID returns 400
  • Response confirms deletion
  • Swagger UI supports testing

Testing Steps

  • Create a book

  • Copy its id

  • Send DELETE request:

    /book/:id
    
  • Verify response is 200 OK

  • Run SQL query:

    SELECT * FROM books WHERE id = <your_id>;
  • Confirm record no longer exists

Definition of Done

  • Endpoint implemented
  • Record deleted from DB
  • Error handling works
  • Swagger docs updated
  • Code linted and formatted

Metadata

Metadata

Labels

No labels
No labels

Projects

Status

Backlog

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions