mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-28 05:05:12 -05:00
fix: sort recent recipes by created_at instead of date_added (#1417)
* added staticmethod decorators to avoid mypy error * exposed created and updated timestamps to schema * changed default sort from date_added to created_at * explicitely sort recent recipes by created_at * removed static method and replaced w/ type: ignore
This commit is contained in:
@@ -83,6 +83,9 @@ class RecipeSummary(MealieModel):
|
||||
date_added: Optional[datetime.date]
|
||||
date_updated: Optional[datetime.datetime]
|
||||
|
||||
created_at: Optional[datetime.datetime]
|
||||
update_at: Optional[datetime.datetime]
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
|
||||
@@ -163,7 +166,7 @@ class Recipe(RecipeSummary):
|
||||
}
|
||||
|
||||
@validator("slug", always=True, pre=True, allow_reuse=True)
|
||||
def validate_slug(slug: str, values):
|
||||
def validate_slug(slug: str, values): # type: ignore
|
||||
if not values.get("name"):
|
||||
return slug
|
||||
|
||||
|
||||
Reference in New Issue
Block a user