mirror of
https://github.com/QuivrHQ/quivr.git
synced 2024-12-18 11:51:41 +03:00
d41a0b4be4
# Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. ## Checklist before requesting a review Please delete options that are not relevant. - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented hard-to-understand areas - [ ] I have ideally added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged ## Screenshots (if appropriate):
35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
from models.settings import get_supabase_client
|
|
from modules.notification.dto.inputs import (
|
|
CreateNotification,
|
|
NotificationUpdatableProperties,
|
|
)
|
|
from modules.notification.repository.notifications import Notifications
|
|
from modules.notification.repository.notifications_interface import (
|
|
NotificationInterface,
|
|
)
|
|
|
|
|
|
class NotificationService:
|
|
repository: NotificationInterface
|
|
|
|
def __init__(self):
|
|
supabase_client = get_supabase_client()
|
|
self.repository = Notifications(supabase_client)
|
|
|
|
def add_notification(self, notification: CreateNotification):
|
|
"""
|
|
Add a notification
|
|
"""
|
|
return self.repository.add_notification(notification)
|
|
|
|
def update_notification_by_id(
|
|
self, notification_id, notification: NotificationUpdatableProperties
|
|
):
|
|
"""
|
|
Update a notification
|
|
"""
|
|
if notification:
|
|
return self.repository.update_notification_by_id(
|
|
notification_id, notification
|
|
)
|