from __future__ import annotations from datetime import datetime, timezone from typing import Optional from sqlalchemy.orm import Session from models.notification import Notification def create_notification( db: Session, *, user_id: int, title: str, message: str, kind: str = "info", link_path: Optional[str] = None, entity_type: Optional[str] = None, entity_id: Optional[int] = None, ) -> Notification: notification = Notification( user_id=user_id, kind=kind, title=title, message=message, link_path=link_path, entity_type=entity_type, entity_id=entity_id, ) db.add(notification) db.commit() db.refresh(notification) return notification