As a Product Manager
I need the ability to apply discounts to products
So that I can manage promotions and sales effectively
Details and Assumptions
Discount Range: The discount percentage should be between 0% and 100%.
Validation: The system should validate the discount percentage and handle invalid inputs gracefully.
Price Update: The product's price should be updated accordingly and reflected in all subsequent retrievals.
No Model Changes: The implementation should not require changes to the existing product model.
Acceptance Criteria
Given a product exists in the system
When I apply a valid discount percentage to the product
Then the product's price is reduced accordingly, saved, and displayed correctly when retrieved
Given I provide an invalid discount percentage (e.g., negative number, over 100%)
When I attempt to apply the discount
Then the system returns a 400 Bad Request error with an appropriate message
Given a product does not exist
When I attempt to apply a discount to it
Then the system returns a 404 Not Found error
As a Product Manager I need the ability to apply discounts to products So that I can manage promotions and sales effectively
Details and Assumptions
No Model Changes: The implementation should not require changes to the existing product model.
Acceptance Criteria