1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-03 04:25:24 +02:00

feat: added "last-modified" header to supported record types (#1379)

* fixed type error

* exposed created/updated timestamps to shopping list schema

* added custom route to mix in "last-modified" header when available in CRUD routes

* mixed in MealieCrudRoute to APIRouters

* added HEAD route for shopping lists/list-items

* replaced default serializer with FastAPI's
This commit is contained in:
Michael Genson 2022-06-21 12:41:14 -05:00 committed by GitHub
parent 5db4dedc3f
commit 292bf7068a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 67 additions and 25 deletions

View file

@ -46,6 +46,8 @@ def serialize_list_items(list_items: list[ShoppingListItemOut]) -> list:
item_dict["id"] = str(item.id)
as_dict.append(item_dict)
# the default serializer fails on certain complex objects, so we use FastAPI's serliazer first
as_dict = utils.jsonify(as_dict)
return as_dict
@ -151,6 +153,8 @@ def test_shopping_list_items_update_many_reorder(
as_dict.append(item_dict)
# update list
# the default serializer fails on certain complex objects, so we use FastAPI's serliazer first
as_dict = utils.jsonify(as_dict)
response = api_client.put(Routes.items, json=as_dict, headers=unique_user.token)
assert response.status_code == 200