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

24 statements  

« prev     ^ index     » next       coverage.py v7.15.2, created at 2026-10-07 03:04 +0000

1from pydantic import UUID4, ConfigDict 

2from sqlalchemy.orm import joinedload 

3from sqlalchemy.orm.interfaces import LoaderOption 

4 

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

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

7from mealie.schema._mealie import MealieModel 

8 

9 

10class UpdateHouseholdPreferences(MealieModel): 

11 private_household: bool = True 

12 lock_recipe_edits_from_other_households: bool = True 

13 first_day_of_week: int = 0 

14 

15 # Recipe Defaults 

16 recipe_public: bool = True 

17 recipe_show_nutrition: bool = False 

18 recipe_show_assets: bool = False 

19 recipe_landscape_view: bool = False 

20 recipe_disable_comments: bool = False 

21 

22 

23class CreateHouseholdPreferences(UpdateHouseholdPreferences): ... 

24 

25 

26class SaveHouseholdPreferences(UpdateHouseholdPreferences): 

27 household_id: UUID4 

28 

29 

30class ReadHouseholdPreferences(CreateHouseholdPreferences): 

31 id: UUID4 

32 model_config = ConfigDict(from_attributes=True) 

33 

34 @classmethod 

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

36 return [ 

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

38 ]