mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-28 21:15:26 -05:00
feature/new-recipe-features (#360)
* unify button styles * fix drag on mobile * recipe instructions section * add carbs * refactor component location * asset start * consolidate view/edit components * asset api * base dialog event * Remove 'content' * remove console.log * add slug prop * remove console.log * recipe assets first pass * add recipeSettings model * fix hide/show when no tags/categories * fix typo Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
@@ -1,12 +1,23 @@
|
||||
import datetime
|
||||
from typing import Any, List, Optional
|
||||
from typing import Any, Optional
|
||||
|
||||
from fastapi_camelcase import CamelModel
|
||||
from mealie.db.models.recipe.recipe import RecipeModel
|
||||
from pydantic import BaseModel, validator
|
||||
from pydantic import BaseModel, Field, validator
|
||||
from pydantic.utils import GetterDict
|
||||
from slugify import slugify
|
||||
|
||||
|
||||
class RecipeSettings(CamelModel):
|
||||
public: bool = True
|
||||
show_nutrition: bool = True
|
||||
show_assets: bool = True
|
||||
landscape_view: bool = True
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
|
||||
|
||||
class RecipeNote(BaseModel):
|
||||
title: str
|
||||
text: str
|
||||
@@ -15,18 +26,29 @@ class RecipeNote(BaseModel):
|
||||
orm_mode = True
|
||||
|
||||
|
||||
class RecipeStep(BaseModel):
|
||||
class RecipeStep(CamelModel):
|
||||
title: Optional[str] = ""
|
||||
text: str
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
|
||||
|
||||
class RecipeAsset(CamelModel):
|
||||
name: str
|
||||
icon: str
|
||||
file_name: Optional[str]
|
||||
|
||||
class Config:
|
||||
orm_mode = True
|
||||
|
||||
|
||||
class Nutrition(BaseModel):
|
||||
calories: Optional[str]
|
||||
fatContent: Optional[str]
|
||||
fiberContent: Optional[str]
|
||||
proteinContent: Optional[str]
|
||||
carbohydrateContent: Optional[str]
|
||||
fiberContent: Optional[str]
|
||||
sodiumContent: Optional[str]
|
||||
sugarContent: Optional[str]
|
||||
|
||||
@@ -41,8 +63,8 @@ class RecipeSummary(BaseModel):
|
||||
image: Optional[Any]
|
||||
|
||||
description: Optional[str]
|
||||
recipeCategory: Optional[List[str]] = []
|
||||
tags: Optional[List[str]] = []
|
||||
recipeCategory: Optional[list[str]] = []
|
||||
tags: Optional[list[str]] = []
|
||||
rating: Optional[int]
|
||||
|
||||
class Config:
|
||||
@@ -69,8 +91,10 @@ class Recipe(RecipeSummary):
|
||||
performTime: Optional[str] = None
|
||||
|
||||
# Mealie Specific
|
||||
settings: Optional[RecipeSettings]
|
||||
assets: Optional[list[RecipeAsset]] = []
|
||||
dateAdded: Optional[datetime.date]
|
||||
notes: Optional[List[RecipeNote]] = []
|
||||
notes: Optional[list[RecipeNote]] = []
|
||||
orgURL: Optional[str]
|
||||
extras: Optional[dict] = {}
|
||||
|
||||
@@ -126,7 +150,7 @@ class Recipe(RecipeSummary):
|
||||
|
||||
|
||||
class AllRecipeRequest(BaseModel):
|
||||
properties: List[str]
|
||||
properties: list[str]
|
||||
limit: Optional[int]
|
||||
|
||||
class Config:
|
||||
|
||||
Reference in New Issue
Block a user