Fix OAuth page

This commit is contained in:
Joren de Graaf
2026-10-19 16:51:53 +02:00
parent a8418cdba7
commit 743785c2e0
54 changed files with 1794 additions and 27 deletions
+41 -1
View File
@@ -104,15 +104,55 @@ RECIPE_ANALYSIS = {'type': 'object', 'properties': {
'include_optional': {'type': 'boolean'},
'substitutions': {'type': 'object', 'additionalProperties': {'type': 'string'}},
}}
STRESS = {'type': 'object', 'required': ['score'], 'properties': {
'score': {'type': 'integer', 'minimum': 0, 'maximum': 10},
'recorded_at': {'type': 'string', 'format': 'date-time', 'description': 'Defaults to now; naive times use the user time zone'},
'timing': {'type': 'string', 'enum': ['anytime', 'before_sleep', 'after_waking']},
'note': {'type': 'string', 'maxLength': 2000},
'tags': {'type': 'array', 'maxItems': 12, 'items': {'type': 'string', 'maxLength': 40}},
'symptoms': {'type': 'array', 'items': {'type': 'string', 'enum': ['tension', 'headache', 'fatigue', 'restlessness']}},
}}
DREAM = {'type': 'object', 'required': ['wake_up_date', 'title', 'narrative'], 'properties': {
'wake_up_date': {'type': 'string', 'format': 'date', 'description': 'Local date on waking; matches Health > Sleep'},
'dreamed_at': {'type': ['string', 'null'], 'format': 'date-time'},
'title': {'type': 'string', 'maxLength': 160},
'narrative': {'type': 'string', 'maxLength': 20000},
'interpretation': {'type': 'string', 'maxLength': 4000},
'tags': {'type': 'array', 'maxItems': 12, 'items': {'type': 'string'}},
'emotions': {'type': 'array', 'maxItems': 12, 'items': {'type': 'string'}},
'vividness': {'type': ['integer', 'null'], 'minimum': 0, 'maximum': 10},
'is_nightmare': {'type': 'boolean'},
'after_waking_notes': {'type': 'string', 'maxLength': 4000},
'append_narrative': {'type': 'string', 'description': 'PATCH only; requires Idempotency-Key'},
'append_after_waking_notes': {'type': 'string', 'description': 'PATCH only; requires Idempotency-Key'},
}}
@require_GET
def schema(request):
document = {
'openapi': '3.1.0', 'info': {'title': 'TaskNest Food and Kitchen API', 'version': '1.0.0'},
'openapi': '3.1.0', 'info': {'title': 'TaskNest API', 'version': '1.0.0'},
'servers': [{'url': '/api/v1'}],
'components': {'securitySchemes': {'bearerToken': {'type': 'http', 'scheme': 'bearer'}}},
'paths': {
'/dreams/': {
'get': operation('Search own dreams by keywords, tags, and wake-up date', 'journal:read'),
'post': operation('Create own dream with optional Idempotency-Key', 'journal:write', DREAM),
},
'/dreams/{id}/': {
'get': operation('Read own dream', 'journal:read'),
'patch': operation('Update or append to own dream; append requires Idempotency-Key', 'journal:write', DREAM),
'delete': operation('Delete own dream', 'journal:write'),
},
'/stress/': {
'get': operation('Search own stress check-ins by text, date, and timing', 'journal:read'),
'post': operation('Create own stress check-in with optional Idempotency-Key', 'journal:write', STRESS),
},
'/stress/{id}/': {
'get': operation('Read own stress check-in', 'journal:read'),
'patch': operation('Update own stress check-in', 'journal:write', STRESS),
'delete': operation('Delete own stress check-in', 'journal:write'),
},
'/food/today/': {'get': operation('Food log for an optional local calendar date, defaulting to today', 'food:read')},
'/food/products/': {'get': operation('Search own food products', 'food:read')},
'/food/products/lookup/': {'get': operation('Look up local and optional Open Food Facts product candidates', 'food:read')},