refactor: stricer domain: notifications

This commit is contained in:
2026-04-11 14:23:50 +02:00
parent 98ed8eeb68
commit db7e683504
30 changed files with 953 additions and 71 deletions

View File

@@ -7,16 +7,23 @@ Owns desktop notification delivery, unread tracking, mute preferences, and the n
```
notifications/
├── application/
│ ├── notifications.facade.ts Stateful domain boundary: settings, unread counts, read markers, delivery decisions
│ └── notifications.effects.ts NgRx glue reacting to room, user, and message actions
│ ├── facades/
│ └── notifications.facade.ts Thin domain boundary, delegates to NotificationsService
│ ├── services/
│ │ └── notifications.service.ts Stateful orchestrator: settings, unread counts, read markers, delivery decisions
│ └── effects/
│ └── notifications.effects.ts NgRx glue reacting to room, user, and message actions
├── domain/
│ ├── notification.logic.ts Pure rules for mute checks, visibility, preview formatting, unread aggregation
│ └── notification.models.ts Settings, unread state, delivery context, and payload contracts
│ ├── logic/
│ └── notification.logic.ts Pure rules for mute checks, visibility, preview formatting, unread aggregation
│ └── models/
│ └── notification.model.ts Settings, unread state, delivery context, and payload contracts
├── infrastructure/
── desktop-notification.service.ts Electron / browser adapter for desktop alerts and window attention
└── notification-settings.storage.ts localStorage persistence with defensive deserialisation
── services/
├── desktop-notification.service.ts Electron / browser adapter for desktop alerts and window attention
│ └── notification-settings-storage.service.ts localStorage persistence with defensive deserialisation
├── feature/
│ └── settings/
@@ -36,6 +43,7 @@ graph TD
Rail[ServersRailComponent]
Sidebar[RoomsSidePanelComponent]
Facade[NotificationsFacade]
Service[NotificationsService]
Logic[notification.logic]
Storage[NotificationSettingsStorageService]
DB[DatabaseService]
@@ -49,17 +57,19 @@ graph TD
Settings --> Facade
Rail --> Facade
Sidebar --> Facade
Facade --> Logic
Facade --> Storage
Facade --> DB
Facade --> Desktop
Facade --> Audio
Facade --> Service
Service --> Logic
Service --> Storage
Service --> DB
Service --> Desktop
Service --> Audio
click Facade "application/notifications.facade.ts" "Stateful domain boundary" _blank
click Effects "application/notifications.effects.ts" "NgRx glue" _blank
click Logic "domain/notification.logic.ts" "Pure notification rules" _blank
click Storage "infrastructure/notification-settings.storage.ts" "localStorage persistence" _blank
click Desktop "infrastructure/desktop-notification.service.ts" "Desktop notification adapter" _blank
click Facade "application/facades/notifications.facade.ts" "Thin domain boundary" _blank
click Service "application/services/notifications.service.ts" "Stateful orchestrator" _blank
click Effects "application/effects/notifications.effects.ts" "NgRx glue" _blank
click Logic "domain/logic/notification.logic.ts" "Pure notification rules" _blank
click Storage "infrastructure/services/notification-settings-storage.service.ts" "localStorage persistence" _blank
click Desktop "infrastructure/services/desktop-notification.service.ts" "Desktop notification adapter" _blank
click Settings "feature/settings/notifications-settings.component.ts" "Notifications settings UI" _blank
click DB "../../infrastructure/persistence/database.service.ts" "Persistence facade" _blank
```
@@ -68,7 +78,7 @@ graph TD
The domain has two runtime entry points:
- `NotificationsFacade` is injected directly by app bootstrapping and feature components.
- `NotificationsFacade` is injected directly by app bootstrapping and feature components. It is a thin pass-through that delegates to `NotificationsService`.
- `NotificationsEffects` is registered globally in `provideEffects(...)` and forwards store actions into the facade.
All effects in this domain are `dispatch: false`. The effect layer never owns notification business rules; it only connects NgRx actions to `NotificationsFacade`.