Clear project — starting fresh from spec
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,41 +0,0 @@
|
||||
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"
|
||||
)
|
||||
Reference in New Issue
Block a user