mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-28 05:05:12 -05: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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user