Coverage for opt/mealie/lib/python3.12/site-packages/mealie/schema/household/household_preferences.py: 100%

24 statements  

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

1from pydantic import UUID4, ConfigDict 1a

2from sqlalchemy.orm import joinedload 1a

3from sqlalchemy.orm.interfaces import LoaderOption 1a

4 

5from mealie.db.models.household.household import Household 1a

6from mealie.db.models.household.preferences import HouseholdPreferencesModel 1a

7from mealie.schema._mealie import MealieModel 1a

8 

9 

10class UpdateHouseholdPreferences(MealieModel): 1a

11 private_household: bool = True 1a

12 lock_recipe_edits_from_other_households: bool = True 1a

13 first_day_of_week: int = 0 1a

14 

15 # Recipe Defaults 

16 recipe_public: bool = True 1a

17 recipe_show_nutrition: bool = False 1a

18 recipe_show_assets: bool = False 1a

19 recipe_landscape_view: bool = False 1a

20 recipe_disable_comments: bool = False 1a

21 

22 

23class CreateHouseholdPreferences(UpdateHouseholdPreferences): ... 1a

24 

25 

26class SaveHouseholdPreferences(UpdateHouseholdPreferences): 1a

27 household_id: UUID4 1a

28 

29 

30class ReadHouseholdPreferences(CreateHouseholdPreferences): 1a

31 id: UUID4 1a

32 model_config = ConfigDict(from_attributes=True) 1a

33 

34 @classmethod 1a

35 def loader_options(cls) -> list[LoaderOption]: 1a

36 return [ 1bc

37 joinedload(HouseholdPreferencesModel.household).load_only(Household.group_id), 

38 ]