| 123456789101112131415161718192021222324252627282930313233343536 |
- # app/services/notification_service.py
- import uuid
- from typing import List, Dict, Any
- from redis.asyncio import Redis
- from app.utils.redis_utils import redis_qpush, redis_qpop
- class NotificationService:
- @staticmethod
- async def create(
- redis_client: Redis,
- ntype: str,
- user_id: str,
- channels: List[str],
- template_id: str,
- payload: Dict[str, Any]
- ) -> None:
- notification_payload = {
- "notification_id": f"nid_{uuid.uuid4().hex}",
- "type": ntype,
- "user_id": user_id,
- "channels": channels,
- "template_id": template_id,
- "payload": payload
- }
- await redis_qpush(
- redis_client,
- "vas_notification_queue",
- notification_payload
- )
-
|