fediversion/backend/helpers.py
fullsizemalt b4cddf41ea feat: Initialize Fediversion multi-band platform
- Fork elmeg-demo codebase for multi-band support
- Add data importer infrastructure with base class
- Create band-specific importers:
  - phish.py: Phish.net API v5
  - grateful_dead.py: Grateful Stats API
  - setlistfm.py: Dead & Company, Billy Strings (Setlist.fm)
- Add spec-kit configuration for Gemini
- Update README with supported bands and architecture
2025-12-28 12:39:28 -08:00

19 lines
751 B
Python

from sqlmodel import Session
from models import Notification
def create_notification(session: Session, user_id: int, title: str, message: str, type: str, link: str = None):
notification = Notification(
user_id=user_id,
title=title,
message=message,
type=type,
link=link
)
session.add(notification)
# Note: caller is responsible for commit if part of larger transaction,
# but for simple notification triggers, we can commit here or let caller do it.
# To be safe and atomic, usually we add to session and let caller commit.
# But for a helper, instant commit ensures specific notification persistence.
session.commit()
session.refresh(notification)
return notification