As a customer
I need to add new item to my wishlist
So that I can keep track of what I want to buy and purchase them later
Details and Assumptions
Create a REST API endpoint to add a new item to a specific wishlist.
The client will provide the wishlist ID in the URL path and the item details in the request body.
The system will generate a unique item ID for each new item.
If the wishlist ID does not exist, the system should return a 404 Not Found error.
If the item with the same name already exists in the given wishlist, the system should return a 409 Conflict error.
The request body must include the item's name, description, and price.
Acceptance Criteria
Given a customer wants to add a new item to a specific wishlist
When they send a POST request to "/wishlists/{wishlistId}/items"
Then the system should add the new item to the specified wishlist in the database
And return the newly created item's details with a 201 Created status
Given a customer sends a POST request to "/wishlists/{wishlistId}/items" with a non-existent wishlistId
When the system cannot find the specified wishlist
Then the system should return a 404 Not Found error with an appropriate error message
Given a customer sends a POST request to "/wishlists/{wishlistId}/items" with an item that already exists in the wishlist
When the system detects a duplicate item
Then the system should return a 409 Conflict error with an appropriate error message
Given a customer sends a POST request to "/wishlists/{wishlistId}/items" with invalid or incomplete item data
When the system validates the request body
Then the system should return a 400 Bad Request error with details about the validation errors
As a customer I need to add new item to my wishlist So that I can keep track of what I want to buy and purchase them later
Details and Assumptions
404 Not Found error
.409 Conflict error
.The request body must include the item's name, description, and price.
Acceptance Criteria
Given a customer sends a POST request to "/wishlists/{wishlistId}/items" with a non-existent wishlistId When the system cannot find the specified wishlist Then the system should return a 404 Not Found error with an appropriate error message
Given a customer sends a POST request to "/wishlists/{wishlistId}/items" with an item that already exists in the wishlist When the system detects a duplicate item Then the system should return a 409 Conflict error with an appropriate error message
Given a customer sends a POST request to "/wishlists/{wishlistId}/items" with invalid or incomplete item data When the system validates the request body Then the system should return a 400 Bad Request error with details about the validation errors