1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-19 21:29:40 +02:00

feat: additional cookbook features (tags, tools, and public) (#1116)

* migration: add public, tags, and tools

* generate frontend types

* add help icon

* start replacement for tool-tag-category selector

* add help icon utility

* use generator types

* add support for cookbook features

* add UI elements for cookbook features

* fix tests

* fix type error
This commit is contained in:
Hayden 2022-04-01 09:50:31 -08:00 committed by GitHub
parent 1092e0ce7c
commit cfaac2e060
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 374 additions and 97 deletions

View file

@ -2,19 +2,23 @@ from pydantic import UUID4, validator
from slugify import slugify
from mealie.schema._mealie import MealieModel
from mealie.schema.recipe.recipe import RecipeSummary, RecipeTool
from ..recipe.recipe_category import CategoryBase, RecipeCategoryResponse
from ..recipe.recipe_category import CategoryBase, TagBase
class CreateCookBook(MealieModel):
name: str
description: str = ""
slug: str = None
slug: str | None = None
position: int = 1
public: bool = False
categories: list[CategoryBase] = []
tags: list[TagBase] = []
tools: list[RecipeTool] = []
@validator("slug", always=True, pre=True)
def validate_slug(slug: str, values):
def validate_slug(slug: str, values): # type: ignore
name: str = values["name"]
calc_slug: str = slugify(name)
@ -42,7 +46,7 @@ class ReadCookBook(UpdateCookBook):
class RecipeCookBook(ReadCookBook):
group_id: UUID4
categories: list[RecipeCategoryResponse]
recipes: list[RecipeSummary]
class Config:
orm_mode = True