Add Judge model for championships
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ from app.models.discipline import Discipline
|
|||||||
from app.models.style import Style
|
from app.models.style import Style
|
||||||
from app.models.fee import Fee
|
from app.models.fee import Fee
|
||||||
from app.models.rule import Rule
|
from app.models.rule import Rule
|
||||||
|
from app.models.judge import Judge
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"User",
|
"User",
|
||||||
@@ -21,4 +22,5 @@ __all__ = [
|
|||||||
"Style",
|
"Style",
|
||||||
"Fee",
|
"Fee",
|
||||||
"Rule",
|
"Rule",
|
||||||
|
"Judge",
|
||||||
]
|
]
|
||||||
|
|||||||
22
backend/app/models/judge.py
Normal file
22
backend/app/models/judge.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import uuid
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
from sqlalchemy import DateTime, ForeignKey, Integer, String, Text, Uuid, func
|
||||||
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||||
|
|
||||||
|
from app.database import Base
|
||||||
|
|
||||||
|
|
||||||
|
class Judge(Base):
|
||||||
|
__tablename__ = "judges"
|
||||||
|
|
||||||
|
id: Mapped[uuid.UUID] = mapped_column(Uuid(as_uuid=True), primary_key=True, default=uuid.uuid4)
|
||||||
|
championship_id: Mapped[uuid.UUID] = mapped_column(Uuid(as_uuid=True), ForeignKey("championships.id", ondelete="CASCADE"), nullable=False)
|
||||||
|
name: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||||
|
instagram: Mapped[str | None] = mapped_column(String(255))
|
||||||
|
bio: Mapped[str | None] = mapped_column(Text)
|
||||||
|
photo_url: Mapped[str | None] = mapped_column(String(2048))
|
||||||
|
sort_order: Mapped[int] = mapped_column(Integer, default=0)
|
||||||
|
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), server_default=func.now())
|
||||||
|
|
||||||
|
championship: Mapped["Championship"] = relationship(back_populates="judges_list") # type: ignore[name-defined]
|
||||||
Reference in New Issue
Block a user