from sqlalchemy.ext.asyncio import AsyncSession from app.models.notification import Notification async def send_notification( db: AsyncSession, user_id: int, type: str, title: str, content: str | None = None, ref_type: str | None = None, ref_id: int | None = None, ): n = Notification( user_id=user_id, type=type, title=title, content=content, ref_type=ref_type, ref_id=ref_id, ) db.add(n) await db.flush() return n