Implement a POST /book endpoint that creates a new book record in the database. The endpoint must validate input and persist valid data.
User Story
Given I hit the /book endpoint with a POST request
When I provide valid book data
Then it should create a record in the database
Request Body
{
"id": 1,
"name": "Book Name",
"author": ["Author One"],
"price": 100,
"publisher": "Publisher Name"
}
Validation Rules
-
id
-
name
-
author
-
price
-
publisher
Tasks
Acceptance Criteria
Testing Steps
Definition of Done
Implement a POST
/bookendpoint that creates a new book record in the database. The endpoint must validate input and persist valid data.User Story
Given I hit the
/bookendpoint with a POST requestWhen I provide valid book data
Then it should create a record in the database
Request Body
{ "id": 1, "name": "Book Name", "author": ["Author One"], "price": 100, "publisher": "Publisher Name" }Validation Rules
idnameauthorpricepublisherTasks
/bookPOST routebookstableAcceptance Criteria
400 Bad Request201 CreatedTesting Steps
Open Swagger UI
Send POST request to
/bookwith valid payloadVerify response is
201 CreatedRun SQL query:
Confirm returned record matches inserted data
Definition of Done