Added inventory amount per food package management
This commit is contained in:
@@ -86,6 +86,10 @@ def schema(request):
|
||||
'patch': operation('Update own inventory item', 'inventory:write', INVENTORY),
|
||||
'delete': operation('Delete own inventory item', 'inventory:write'),
|
||||
},
|
||||
'/kitchen/stock/': {'get': operation('Read product stock and packages', 'inventory:read')},
|
||||
'/kitchen/consumption/preview/': {'post': operation('Preview package deductions without changing stock', 'inventory:read')},
|
||||
'/kitchen/consumption/': {'post': operation('Consume stock atomically with Idempotency-Key', 'inventory:write')},
|
||||
'/kitchen/consumption/{id}/undo/': {'post': operation('Undo a safe consumption transaction', 'inventory:write')},
|
||||
},
|
||||
}
|
||||
for path, methods in document['paths'].items():
|
||||
@@ -94,6 +98,9 @@ def schema(request):
|
||||
'schema': {'type': 'string', 'format': 'uuid'}}]
|
||||
if 'post' in methods:
|
||||
methods['post']['responses']['201'] = methods['post']['responses'].pop('200')
|
||||
for path in ('/kitchen/consumption/preview/', '/kitchen/consumption/',
|
||||
'/kitchen/consumption/{id}/undo/'):
|
||||
document['paths'][path]['post']['responses']['200'] = document['paths'][path]['post']['responses'].pop('201')
|
||||
document['paths']['/food/today/']['get']['parameters'] = [{
|
||||
'name': 'date', 'in': 'query', 'required': False,
|
||||
'description': 'Local calendar date; defaults to today in the user time zone.',
|
||||
|
||||
Reference in New Issue
Block a user