1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-07 14:35:25 +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

@ -1,6 +1,7 @@
from __future__ import annotations
from typing import Optional
from datetime import datetime
from typing import Optional, Union
from pydantic import UUID4
@ -38,6 +39,9 @@ class ShoppingListItemCreate(MealieModel):
label_id: Optional[UUID4] = None
recipe_references: list[ShoppingListItemRecipeRef] = []
created_at: Optional[datetime]
update_at: Optional[datetime]
class ShoppingListItemUpdate(ShoppingListItemCreate):
id: UUID4
@ -45,7 +49,7 @@ class ShoppingListItemUpdate(ShoppingListItemCreate):
class ShoppingListItemOut(ShoppingListItemUpdate):
label: Optional[MultiPurposeLabelSummary]
recipe_references: list[ShoppingListItemRecipeRefOut] = []
recipe_references: list[Union[ShoppingListItemRecipeRef, ShoppingListItemRecipeRefOut]] = []
class Config:
orm_mode = True
@ -54,6 +58,9 @@ class ShoppingListItemOut(ShoppingListItemUpdate):
class ShoppingListCreate(MealieModel):
name: str = None
created_at: Optional[datetime]
update_at: Optional[datetime]
class ShoppingListRecipeRefOut(MealieModel):
id: UUID4