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

64 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 import GroupEventNotifierModel 

6from mealie.schema._mealie import MealieModel 

7from mealie.schema.response.pagination import PaginationBase 

8 

9# ============================================================================= 

10# Group Events Notifier Options 

11 

12 

13class GroupEventNotifierOptions(MealieModel): 

14 """ 

15 These events are in-sync with the EventTypes found in the EventBusService. 

16 If you modify this, make sure to update the EventBusService as well. 

17 """ 

18 

19 test_message: bool = False 

20 webhook_task: bool = False 

21 

22 recipe_created: bool = False 

23 recipe_updated: bool = False 

24 recipe_deleted: bool = False 

25 

26 user_signup: bool = False 

27 

28 data_migrations: bool = False 

29 data_export: bool = False 

30 data_import: bool = False 

31 

32 mealplan_entry_created: bool = False 

33 

34 shopping_list_created: bool = False 

35 shopping_list_updated: bool = False 

36 shopping_list_deleted: bool = False 

37 

38 cookbook_created: bool = False 

39 cookbook_updated: bool = False 

40 cookbook_deleted: bool = False 

41 

42 tag_created: bool = False 

43 tag_updated: bool = False 

44 tag_deleted: bool = False 

45 

46 category_created: bool = False 

47 category_updated: bool = False 

48 category_deleted: bool = False 

49 

50 label_created: bool = False 

51 label_updated: bool = False 

52 label_deleted: bool = False 

53 

54 

55class GroupEventNotifierOptionsSave(GroupEventNotifierOptions): 

56 notifier_id: UUID4 

57 

58 

59class GroupEventNotifierOptionsOut(GroupEventNotifierOptions): 

60 id: UUID4 

61 model_config = ConfigDict(from_attributes=True) 

62 

63 

64# ======================================================================= 

65# Notifiers 

66 

67 

68class GroupEventNotifierCreate(MealieModel): 

69 name: str 

70 apprise_url: str | None = None 

71 

72 

73class GroupEventNotifierSave(GroupEventNotifierCreate): 

74 enabled: bool = True 

75 group_id: UUID4 

76 household_id: UUID4 

77 options: GroupEventNotifierOptions = GroupEventNotifierOptions() 

78 

79 

80class GroupEventNotifierUpdate(GroupEventNotifierSave): 

81 id: UUID4 

82 apprise_url: str | None = None 

83 

84 

85class GroupEventNotifierOut(MealieModel): 

86 id: UUID4 

87 name: str 

88 enabled: bool 

89 group_id: UUID4 

90 household_id: UUID4 

91 options: GroupEventNotifierOptionsOut 

92 model_config = ConfigDict(from_attributes=True) 

93 

94 @classmethod 

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

96 return [joinedload(GroupEventNotifierModel.options)] 

97 

98 

99class GroupEventPagination(PaginationBase): 

100 items: list[GroupEventNotifierOut] 

101 

102 

103class GroupEventNotifierPrivate(GroupEventNotifierOut): 

104 apprise_url: str 

105 model_config = ConfigDict(from_attributes=True)