mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-12 21:35:18 -05:00
refactor schema folders
This commit is contained in:
6
mealie/schema/admin/__init__.py
Normal file
6
mealie/schema/admin/__init__.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from .about import *
|
||||
from .backup import *
|
||||
from .migration import *
|
||||
from .restore import *
|
||||
from .settings import *
|
||||
from .theme import *
|
||||
@@ -1,9 +1,10 @@
|
||||
from datetime import datetime
|
||||
from typing import List
|
||||
|
||||
from mealie.schema.restore import RecipeImport
|
||||
from pydantic.main import BaseModel
|
||||
|
||||
from .restore import RecipeImport
|
||||
|
||||
|
||||
class ChowdownURL(BaseModel):
|
||||
url: str
|
||||
@@ -1,10 +1,11 @@
|
||||
from typing import Optional
|
||||
|
||||
from fastapi_camelcase import CamelModel
|
||||
from mealie.schema.category import CategoryBase, RecipeCategoryResponse
|
||||
from pydantic import validator
|
||||
from slugify import slugify
|
||||
|
||||
from ..recipe.category import CategoryBase, RecipeCategoryResponse
|
||||
|
||||
|
||||
class SiteSettings(CamelModel):
|
||||
language: str = "en-US"
|
||||
2
mealie/schema/events/__init__.py
Normal file
2
mealie/schema/events/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from .event_notifications import *
|
||||
from .events import *
|
||||
2
mealie/schema/meal_plan/__init__.py
Normal file
2
mealie/schema/meal_plan/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
from .meal import *
|
||||
from .shopping_list import *
|
||||
4
mealie/schema/recipe/__init__.py
Normal file
4
mealie/schema/recipe/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from .category import *
|
||||
from .comments import *
|
||||
from .helpers import *
|
||||
from .recipe import *
|
||||
@@ -1,7 +1,6 @@
|
||||
from typing import List, Optional
|
||||
|
||||
from fastapi_camelcase import CamelModel
|
||||
from mealie.schema.recipe import Recipe
|
||||
from pydantic.utils import GetterDict
|
||||
|
||||
|
||||
@@ -25,7 +24,7 @@ class CategoryBase(CategoryIn):
|
||||
|
||||
|
||||
class RecipeCategoryResponse(CategoryBase):
|
||||
recipes: Optional[List[Recipe]]
|
||||
recipes: Optional[List["Recipe"]]
|
||||
|
||||
class Config:
|
||||
schema_extra = {"example": {"id": 1, "name": "dinner", "recipes": [{}]}}
|
||||
@@ -41,3 +40,9 @@ class TagBase(CategoryBase):
|
||||
|
||||
class RecipeTagResponse(RecipeCategoryResponse):
|
||||
pass
|
||||
|
||||
|
||||
from .recipe import Recipe
|
||||
|
||||
RecipeCategoryResponse.update_forward_refs()
|
||||
RecipeTagResponse.update_forward_refs()
|
||||
@@ -6,11 +6,16 @@ from typing import Any, Optional
|
||||
from fastapi_camelcase import CamelModel
|
||||
from mealie.core.config import app_dirs, settings
|
||||
from mealie.db.models.recipe.recipe import RecipeModel
|
||||
from mealie.schema.comments import CommentOut
|
||||
from pydantic import BaseModel, Field, validator
|
||||
from pydantic.utils import GetterDict
|
||||
from slugify import slugify
|
||||
|
||||
from .comments import CommentOut
|
||||
|
||||
|
||||
class CreateRecipe(CamelModel):
|
||||
name: str
|
||||
|
||||
|
||||
class RecipeImageTypes(str, Enum):
|
||||
original = "original.webp"
|
||||
@@ -120,8 +125,8 @@ class RecipeSummary(CamelModel):
|
||||
|
||||
class Recipe(RecipeSummary):
|
||||
recipe_yield: Optional[str]
|
||||
recipe_ingredient: Optional[list[RecipeIngredient]]
|
||||
recipe_instructions: Optional[list[RecipeStep]]
|
||||
recipe_ingredient: Optional[list[RecipeIngredient]] = []
|
||||
recipe_instructions: Optional[list[RecipeStep]] = []
|
||||
nutrition: Optional[Nutrition]
|
||||
tools: Optional[list[str]] = []
|
||||
|
||||
3
mealie/schema/user/__init__.py
Normal file
3
mealie/schema/user/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from .auth import *
|
||||
from .sign_up import *
|
||||
from .user import *
|
||||
@@ -4,13 +4,13 @@ from fastapi_camelcase import CamelModel
|
||||
from mealie.core.config import settings
|
||||
from mealie.db.models.group import Group
|
||||
from mealie.db.models.users import User
|
||||
from mealie.schema.category import CategoryBase
|
||||
from mealie.schema.meal import MealPlanOut
|
||||
from mealie.schema.recipe import RecipeSummary
|
||||
from mealie.schema.shopping_list import ShoppingListOut
|
||||
from pydantic.types import constr
|
||||
from pydantic.utils import GetterDict
|
||||
|
||||
from ..meal_plan import MealPlanOut, ShoppingListOut
|
||||
from ..recipe import CategoryBase
|
||||
|
||||
|
||||
class LoingLiveTokenIn(CamelModel):
|
||||
name: str
|
||||
Reference in New Issue
Block a user