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:
parent
5db4dedc3f
commit
292bf7068a
10 changed files with 67 additions and 25 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue