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:
Hayden
2021-10-28 19:28:33 -08:00
committed by GitHub
parent 1e5ef28f91
commit 2afaf70a03
24 changed files with 295 additions and 65 deletions

View File

@@ -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")

View File

@@ -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]

View File

@@ -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):