Files
CIAgent/apps/api/app/repositories/notification_delivery_repository.py
saksham 1a4c80958f Initial commit: CI Agent competitive-intelligence monitoring app
FastAPI + Celery + Next.js + Postgres/Redis app with company monitoring,
source collection, LLM-based change analysis, enrichment, and account
security (Turnstile, escalating lockout, email verification).
2026-08-05 10:48:20 -04:00

25 lines
746 B
Python

from __future__ import annotations
import uuid
from sqlalchemy import select
from sqlalchemy.ext.asyncio import AsyncSession
from app.models.notification_delivery import NotificationDelivery
class NotificationDeliveryRepository:
def __init__(self, db: AsyncSession) -> None:
self.db = db
async def create(self, delivery: NotificationDelivery) -> NotificationDelivery:
self.db.add(delivery)
await self.db.flush()
return delivery
async def list_for_alert(self, alert_id: uuid.UUID) -> list[NotificationDelivery]:
result = await self.db.execute(
select(NotificationDelivery).where(NotificationDelivery.alert_id == alert_id)
)
return list(result.scalars().all())