Added inventory amount per food package management

This commit is contained in:
Joren de Graaf
2026-10-11 15:46:22 +02:00
parent 400e8254c0
commit cb12c23732
19 changed files with 927 additions and 35 deletions
+7
View File
@@ -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.',