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
« 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
5from mealie.db.models.household import GroupEventNotifierModel
6from mealie.schema._mealie import MealieModel
7from mealie.schema.response.pagination import PaginationBase
9# =============================================================================
10# Group Events Notifier Options
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 """
19 test_message: bool = False
20 webhook_task: bool = False
22 recipe_created: bool = False
23 recipe_updated: bool = False
24 recipe_deleted: bool = False
26 user_signup: bool = False
28 data_migrations: bool = False
29 data_export: bool = False
30 data_import: bool = False
32 mealplan_entry_created: bool = False
34 shopping_list_created: bool = False
35 shopping_list_updated: bool = False
36 shopping_list_deleted: bool = False
38 cookbook_created: bool = False
39 cookbook_updated: bool = False
40 cookbook_deleted: bool = False
42 tag_created: bool = False
43 tag_updated: bool = False
44 tag_deleted: bool = False
46 category_created: bool = False
47 category_updated: bool = False
48 category_deleted: bool = False
50 label_created: bool = False
51 label_updated: bool = False
52 label_deleted: bool = False
55class GroupEventNotifierOptionsSave(GroupEventNotifierOptions):
56 notifier_id: UUID4
59class GroupEventNotifierOptionsOut(GroupEventNotifierOptions):
60 id: UUID4
61 model_config = ConfigDict(from_attributes=True)
64# =======================================================================
65# Notifiers
68class GroupEventNotifierCreate(MealieModel):
69 name: str
70 apprise_url: str | None = None
73class GroupEventNotifierSave(GroupEventNotifierCreate):
74 enabled: bool = True
75 group_id: UUID4
76 household_id: UUID4
77 options: GroupEventNotifierOptions = GroupEventNotifierOptions()
80class GroupEventNotifierUpdate(GroupEventNotifierSave):
81 id: UUID4
82 apprise_url: str | None = None
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)
94 @classmethod
95 def loader_options(cls) -> list[LoaderOption]:
96 return [joinedload(GroupEventNotifierModel.options)]
99class GroupEventPagination(PaginationBase):
100 items: list[GroupEventNotifierOut]
103class GroupEventNotifierPrivate(GroupEventNotifierOut):
104 apprise_url: str
105 model_config = ConfigDict(from_attributes=True)