mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-28 21:15:26 -05:00
feat: support require_all property for cookbooks (#1130)
* add direction prop for icon position * add support for require_all properties on cookbook * update type annotations * add and - or filter support * update cookbook API * generate types * implement editor for additional options * update version number
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from collections.abc import Generator
|
||||
|
||||
import sqlalchemy as sa
|
||||
from sqlalchemy.orm import sessionmaker
|
||||
from sqlalchemy.orm.session import Session
|
||||
@@ -32,7 +34,7 @@ def create_session() -> Session:
|
||||
return SessionLocal()
|
||||
|
||||
|
||||
def generate_session() -> Session:
|
||||
def generate_session() -> Generator[Session, None, None]:
|
||||
global SessionLocal
|
||||
db = SessionLocal()
|
||||
try:
|
||||
|
||||
@@ -21,8 +21,13 @@ class CookBook(SqlAlchemyBase, BaseMixins):
|
||||
public = Column(Boolean, default=False)
|
||||
|
||||
categories = orm.relationship(Category, secondary=cookbooks_to_categories, single_parent=True)
|
||||
require_all_categories = Column(Boolean, default=True)
|
||||
|
||||
tags = orm.relationship(Tag, secondary=cookbooks_to_tags, single_parent=True)
|
||||
require_all_tags = Column(Boolean, default=True)
|
||||
|
||||
tools = orm.relationship(Tool, secondary=cookbooks_to_tools, single_parent=True)
|
||||
require_all_tools = Column(Boolean, default=True)
|
||||
|
||||
@auto_init()
|
||||
def __init__(self, **_) -> None:
|
||||
|
||||
@@ -20,7 +20,7 @@ from .note import Note
|
||||
from .nutrition import Nutrition
|
||||
from .settings import RecipeSettings
|
||||
from .shared import RecipeShareTokenModel
|
||||
from .tag import Tag, recipes_to_tags
|
||||
from .tag import recipes_to_tags
|
||||
from .tool import recipes_to_tools
|
||||
|
||||
|
||||
@@ -99,7 +99,7 @@ class RecipeModel(SqlAlchemyBase, BaseMixins):
|
||||
|
||||
# Mealie Specific
|
||||
settings = orm.relationship("RecipeSettings", uselist=False, cascade="all, delete-orphan")
|
||||
tags: list[Tag] = orm.relationship("Tag", secondary=recipes_to_tags, back_populates="recipes")
|
||||
tags = orm.relationship("Tag", secondary=recipes_to_tags, back_populates="recipes")
|
||||
notes: list[Note] = orm.relationship("Note", cascade="all, delete-orphan")
|
||||
rating = sa.Column(sa.Integer)
|
||||
org_url = sa.Column(sa.String)
|
||||
|
||||
Reference in New Issue
Block a user