Coverage for opt/mealie/lib/python3.12/site-packages/mealie/db/models/recipe/settings.py: 100%

23 statements  

« prev     ^ index     » next       coverage.py v7.10.6, created at 2025-11-25 15:48 +0000

1import sqlalchemy as sa 1a

2from sqlalchemy.orm import Mapped, mapped_column 1a

3 

4from mealie.db.models._model_base import SqlAlchemyBase 1a

5from mealie.db.models._model_utils.guid import GUID 1a

6 

7 

8class RecipeSettings(SqlAlchemyBase): 1a

9 __tablename__ = "recipe_settings" 1a

10 id: Mapped[int] = mapped_column(sa.Integer, primary_key=True) 1a

11 recipe_id: Mapped[GUID | None] = mapped_column(GUID, sa.ForeignKey("recipes.id"), index=True) 1a

12 public: Mapped[bool | None] = mapped_column(sa.Boolean) 1a

13 show_nutrition: Mapped[bool | None] = mapped_column(sa.Boolean) 1a

14 show_assets: Mapped[bool | None] = mapped_column(sa.Boolean) 1a

15 landscape_view: Mapped[bool | None] = mapped_column(sa.Boolean) 1a

16 disable_comments: Mapped[bool | None] = mapped_column(sa.Boolean, default=False) 1a

17 locked: Mapped[bool | None] = mapped_column(sa.Boolean, default=False) 1a

18 

19 # Deprecated 

20 disable_amount: Mapped[bool | None] = mapped_column(sa.Boolean, default=True) 1a

21 

22 def __init__( 1a

23 self, 

24 public=True, 

25 show_nutrition=True, 

26 show_assets=True, 

27 landscape_view=True, 

28 disable_amount=True, 

29 disable_comments=False, 

30 locked=False, 

31 ) -> None: 

32 self.locked = locked 1bc

33 self.public = public 1bc

34 self.show_nutrition = show_nutrition 1bc

35 self.show_assets = show_assets 1bc

36 self.landscape_view = landscape_view 1bc

37 self.disable_amount = disable_amount 1bc

38 self.disable_comments = disable_comments 1bc