You've already forked RekomenciBackend
21 lines
682 B
Python
21 lines
682 B
Python
import asyncio
|
|
from typing import override
|
|
|
|
from firebase_admin import messaging # type: ignore[import-untyped]
|
|
from firebase_admin.messaging import Message, Notification # type: ignore[import-untyped]
|
|
|
|
from template_project.application.common.notifications.service import NotificationService
|
|
|
|
|
|
class FCMNotificationService(NotificationService):
|
|
def __init__(self) -> None:
|
|
pass
|
|
|
|
@override
|
|
async def send_notification(self, identifier: str, title: str, body: str) -> None:
|
|
message = Message(
|
|
token=identifier,
|
|
notification=Notification(title=title, body=body),
|
|
)
|
|
await asyncio.to_thread(messaging.send, message)
|