Full-stack mobile app for pole dance championship management. Backend: FastAPI + SQLAlchemy 2 (async) + SQLite (dev) / PostgreSQL (prod) - JWT auth with refresh token rotation - Championship CRUD with Instagram Graph API sync (APScheduler) - Registration flow with status management - Participant list publish with Expo push notifications - Alembic migrations, pytest test suite Mobile: React Native + Expo (TypeScript) - Auth gate: pending approval screen for new members - Championships list & detail screens - Registration form with status tracking - React Query + Zustand + React Navigation v6 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
35 lines
1.3 KiB
Python
35 lines
1.3 KiB
Python
import uuid
|
|
from datetime import datetime, timezone
|
|
|
|
from sqlalchemy import DateTime, ForeignKey, Index, String, Text
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from app.database import Base
|
|
|
|
|
|
def _now() -> datetime:
|
|
return datetime.now(timezone.utc)
|
|
|
|
|
|
class NotificationLog(Base):
|
|
__tablename__ = "notification_log"
|
|
__table_args__ = (Index("idx_notification_log_user_id", "user_id"),)
|
|
|
|
id: Mapped[uuid.UUID] = mapped_column(primary_key=True, default=uuid.uuid4)
|
|
user_id: Mapped[uuid.UUID] = mapped_column(
|
|
ForeignKey("users.id", ondelete="CASCADE"), nullable=False
|
|
)
|
|
registration_id: Mapped[uuid.UUID | None] = mapped_column(
|
|
ForeignKey("registrations.id", ondelete="SET NULL")
|
|
)
|
|
type: Mapped[str] = mapped_column(String(50), nullable=False)
|
|
title: Mapped[str] = mapped_column(String(255), nullable=False)
|
|
body: Mapped[str] = mapped_column(Text, nullable=False)
|
|
sent_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=_now)
|
|
delivery_status: Mapped[str] = mapped_column(String(30), default="pending")
|
|
|
|
user: Mapped["User"] = relationship(back_populates="notification_logs")
|
|
registration: Mapped["Registration | None"] = relationship(
|
|
back_populates="notification_logs"
|
|
)
|