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>
42 lines
1.8 KiB
Python
42 lines
1.8 KiB
Python
import uuid
|
|
from datetime import datetime, timezone
|
|
|
|
from sqlalchemy import DateTime, String, Text
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from app.database import Base
|
|
|
|
|
|
def _now() -> datetime:
|
|
return datetime.now(timezone.utc)
|
|
|
|
|
|
class Championship(Base):
|
|
__tablename__ = "championships"
|
|
|
|
id: Mapped[uuid.UUID] = mapped_column(primary_key=True, default=uuid.uuid4)
|
|
title: Mapped[str] = mapped_column(String(500), nullable=False)
|
|
description: Mapped[str | None] = mapped_column(Text)
|
|
location: Mapped[str | None] = mapped_column(String(500))
|
|
event_date: Mapped[datetime | None] = mapped_column(DateTime(timezone=True))
|
|
registration_open_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True))
|
|
registration_close_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True))
|
|
status: Mapped[str] = mapped_column(String(30), nullable=False, default="draft")
|
|
# 'draft' | 'open' | 'closed' | 'completed'
|
|
source: Mapped[str] = mapped_column(String(20), nullable=False, default="manual")
|
|
# 'manual' | 'instagram'
|
|
instagram_media_id: Mapped[str | None] = mapped_column(String(100), unique=True)
|
|
image_url: Mapped[str | None] = mapped_column(String(1000))
|
|
raw_caption_text: Mapped[str | None] = mapped_column(Text)
|
|
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), default=_now)
|
|
updated_at: Mapped[datetime] = mapped_column(
|
|
DateTime(timezone=True), default=_now, onupdate=_now
|
|
)
|
|
|
|
registrations: Mapped[list["Registration"]] = relationship(
|
|
back_populates="championship", cascade="all, delete-orphan"
|
|
)
|
|
participant_list: Mapped["ParticipantList | None"] = relationship(
|
|
back_populates="championship", cascade="all, delete-orphan"
|
|
)
|