from __future__ import annotations from app.projects.repositories.notification_repository import NotificationRepository class NotificationService: def __init__(self, repository: NotificationRepository) -> None: self.repository = repository async def get_preferences(self, workspace_id: str, user_id: str) -> list[dict]: prefs = await self.repository.get_preferences(workspace_id, user_id) return [{"event_type": p.event_type, "enabled": p.enabled} for p in prefs] async def update_preference(self, workspace_id: str, user_id: str, event_type: str, enabled: bool) -> dict: pref = await self.repository.update_preference(workspace_id, user_id, event_type, enabled) return {"event_type": pref.event_type, "enabled": pref.enabled}