Files
RekomenciBackend/src/template_project/adapters/notifications/fcm.py
T
2025-11-20 21:25:48 +03:00

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)