Skip to content

Commit

Permalink
Adjust persist_notification_update params
Browse files Browse the repository at this point in the history
  • Loading branch information
hugobessa committed Nov 28, 2024
1 parent 60371d7 commit f5a15f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion vintasend/services/notification_backends/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def persist_notification(
def persist_notification_update(
self,
notification_id: int | str | uuid.UUID,
**kwargs: "UpdateNotificationKwargs",
update_data: "UpdateNotificationKwargs",
) -> "Notification":
"""
Update a notification in the backend. This method should return the updated notification.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def get_pending_notifications(self, page: int, page_size: int) -> list[Notificat

def persist_notification(
self,
user_id: uuid.UUID,
user_id: uuid.UUID | str | int,
notification_type: str,
title: str,
body_template: str,
Expand Down Expand Up @@ -146,11 +146,11 @@ def persist_notification(
return notification

def persist_notification_update(
self, notification_id: int | str | uuid.UUID, **kwargs: UpdateNotificationKwargs
self, notification_id: int | str | uuid.UUID, updated_data: UpdateNotificationKwargs
) -> Notification:
notification = self.get_notification(notification_id)

for key, value in kwargs.items():
for key, value in updated_data.items():
setattr(notification, key, value)

return notification
Expand Down Expand Up @@ -209,7 +209,7 @@ def __paginate_notifications(self, notifications: list[Notification], page: int,

def get_user_email_from_notification(self, notification_id: int | str | uuid.UUID) -> str:
notification = self.get_notification(notification_id)
return notification.context_kwargs.get("email", "[email protected]")
return str(notification.context_kwargs.get("email", "[email protected]"))

def store_context_used(self, notification_id: int | str | uuid.UUID, context: dict) -> None:
notification = self.get_notification(notification_id)
Expand Down

0 comments on commit f5a15f0

Please sign in to comment.