From f5a15f069700052325b1b0b08259e03506c487cd Mon Sep 17 00:00:00 2001 From: Hugo bessa Date: Thu, 28 Nov 2024 00:11:35 -0300 Subject: [PATCH] Adjust persist_notification_update params --- vintasend/services/notification_backends/base.py | 2 +- .../services/notification_backends/stubs/fake_backend.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vintasend/services/notification_backends/base.py b/vintasend/services/notification_backends/base.py index dbdac7e..2d20650 100644 --- a/vintasend/services/notification_backends/base.py +++ b/vintasend/services/notification_backends/base.py @@ -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. diff --git a/vintasend/services/notification_backends/stubs/fake_backend.py b/vintasend/services/notification_backends/stubs/fake_backend.py index 5138daf..91a0dd0 100644 --- a/vintasend/services/notification_backends/stubs/fake_backend.py +++ b/vintasend/services/notification_backends/stubs/fake_backend.py @@ -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, @@ -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 @@ -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", "testemail@example.com") + return str(notification.context_kwargs.get("email", "testemail@example.com")) def store_context_used(self, notification_id: int | str | uuid.UUID, context: dict) -> None: notification = self.get_notification(notification_id)