1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-24 15:49:42 +02:00
mealie/mealie/schema/recipe/recipe_comments.py
Michael Genson cb15db2d27
feat: re-write get all routes to use pagination (#1424)
rewrite get_all routes to use a pagination pattern to allow for better implementations of search, filter, and sorting on the frontend or by any client without fetching all the data. Additionally we added a CI check for running the Nuxt built to confirm that no TS errors were present. Finally, I had to remove the header support for the Shopping lists as the browser caching based off last_updated header was not allowing it to read recent updates due to how we're handling the updated_at property in the database with nested fields. This will have to be looked at in the future to reimplement. I'm unsure how many other routes have a similar issue. 

Co-authored-by: Hayden <64056131+hay-kot@users.noreply.github.com>
2022-06-25 11:39:38 -08:00

46 lines
835 B
Python

from datetime import datetime
from typing import Optional
from pydantic import UUID4
from mealie.schema._mealie import MealieModel
from mealie.schema.response.pagination import PaginationBase
class UserBase(MealieModel):
id: UUID4
username: Optional[str]
admin: bool
class Config:
orm_mode = True
class RecipeCommentCreate(MealieModel):
recipe_id: UUID4
text: str
class RecipeCommentSave(RecipeCommentCreate):
user_id: UUID4
class RecipeCommentUpdate(MealieModel):
id: UUID4
text: str
class RecipeCommentOut(RecipeCommentCreate):
id: UUID4
recipe_id: UUID4
created_at: datetime
update_at: datetime
user_id: UUID4
user: UserBase
class Config:
orm_mode = True
class RecipeCommentPagination(PaginationBase):
items: list[RecipeCommentOut]