mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-10 20:35:14 -05:00
feat(backend): ✨ Minor linting, bulk URL import, and improve BG tasks (#760)
* Fixes #751 * Fixes not showing original URL * start slice at 0 instead of 1 * remove print statements * add linter for print statements and remove print * hide all buttons when edit disabled * add bulk import API * update attribute bindings * unify button styles * bulk add recipe feature * thanks linter! * uncomment code Co-authored-by: Hayden <hay-kot@pm.me>
This commit is contained in:
@@ -25,7 +25,6 @@ class CreatePlanEntry(CamelModel):
|
||||
@validator("recipe_id", always=True)
|
||||
@classmethod
|
||||
def id_or_title(cls, value, values):
|
||||
print(value, values)
|
||||
if bool(value) is False and bool(values["title"]) is False:
|
||||
raise ValueError(f"`recipe_id={value}` or `title={values['title']}` must be provided")
|
||||
|
||||
|
||||
@@ -21,17 +21,6 @@ from .recipe_step import RecipeStep
|
||||
app_dirs = get_app_dirs()
|
||||
|
||||
|
||||
class CreateRecipeByURL(BaseModel):
|
||||
url: str
|
||||
|
||||
class Config:
|
||||
schema_extra = {"example": {"url": "https://myfavoriterecipes.com/recipes"}}
|
||||
|
||||
|
||||
class CreateRecipe(CamelModel):
|
||||
name: str
|
||||
|
||||
|
||||
class RecipeTag(CamelModel):
|
||||
name: str
|
||||
slug: str
|
||||
@@ -44,6 +33,27 @@ class RecipeCategory(RecipeTag):
|
||||
pass
|
||||
|
||||
|
||||
class CreateRecipeByUrl(BaseModel):
|
||||
url: str
|
||||
|
||||
class Config:
|
||||
schema_extra = {"example": {"url": "https://myfavoriterecipes.com/recipes"}}
|
||||
|
||||
|
||||
class CreateRecipeBulk(BaseModel):
|
||||
url: str
|
||||
categories: list[RecipeCategory] = None
|
||||
tags: list[RecipeTag] = None
|
||||
|
||||
|
||||
class CreateRecipeByUrlBulk(BaseModel):
|
||||
imports: list[CreateRecipeBulk]
|
||||
|
||||
|
||||
class CreateRecipe(CamelModel):
|
||||
name: str
|
||||
|
||||
|
||||
class RecipeSummary(CamelModel):
|
||||
id: Optional[int]
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ from pydantic import Field
|
||||
class ServerTaskNames(str, enum.Enum):
|
||||
default = "Background Task"
|
||||
backup_task = "Database Backup"
|
||||
bulk_recipe_import = "Bulk Recipe Import"
|
||||
|
||||
|
||||
class ServerTaskStatus(str, enum.Enum):
|
||||
|
||||
Reference in New Issue
Block a user