Add ProductDiscount - MarcoLagalla/marette_backend GitHub Wiki

Name List ProductDiscounts
Description List all discounts registered for the given restaurant
URL webapp/restaurant/<int:id>/products/discounts/add
Allowed methods POST
Authorizations GET (IsBusiness, IsOwner)

POST

Create a new ProductDiscount available into the restaurant matching the given ID.

Field Type Required Unique Comments
title string yes no name to display
type DISCOUNT_TYPES_CHOICES yes no Fisso or Percentuale
value decimal yes no if type=Percentuale must be in range [0-100]

A 'Fixed' discount express a 'value' that is a decimal (positive) number that has to be subtracted to the original price. A 'Percentage' discount express a 'value' in the range from 0% to 100% of the original price that has to be subtracted.

Return codes

Status Description
HTTP_201_CREATED ok
HTTP_404_NOT_FOUND restaurant with this ID not found
HTTP_400_BAD_REQUEST wrong parameters
HTTP_401_UNAUTHORIZED action not authorized
⚠️ **GitHub.com Fallback** ⚠️