Spaces:
Running on T4
Running on T4
Download backend/app/modules/arm_care/models.py from modventures/baseball-engine: direct link, hf CLI and curl.
- Browser
- Download file 1.51 kB
-
https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/backend/app/modules/arm_care/models.py
- Command line
-
hf download hf://spaces/modventures/baseball-engine/backend/app/modules/arm_care/models.py
-
curl -L -o models.py https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/backend/app/modules/arm_care/models.py
1.51 kB
| import uuid | |
| from datetime import date | |
| from sqlalchemy import CheckConstraint, Date, ForeignKey, Index, SmallInteger, String, text | |
| from sqlalchemy.dialects.postgresql import UUID | |
| from sqlalchemy.orm import Mapped, mapped_column | |
| from app.common.base_model import Base, CreatedAtMixin, IdMixin | |
| def _owner() -> Mapped[uuid.UUID]: | |
| return mapped_column(UUID(as_uuid=True), ForeignKey("accounts.id", ondelete="CASCADE")) | |
| class ArmOuting(IdMixin, CreatedAtMixin, Base): | |
| """A game pitch count the player logged. local_date is the player's calendar day.""" | |
| __tablename__ = "arm_outings" | |
| __table_args__ = ( | |
| CheckConstraint("pitches BETWEEN 1 AND 200", name="pitches"), | |
| CheckConstraint("source IN ('game')", name="source"), | |
| Index("ix_arm_outings_owner_id_local_date", "owner_id", text("local_date DESC")), | |
| ) | |
| owner_id: Mapped[uuid.UUID] = _owner() | |
| local_date: Mapped[date] = mapped_column(Date) | |
| pitches: Mapped[int] = mapped_column(SmallInteger) | |
| source: Mapped[str] = mapped_column(String(8), server_default="game") | |
| class ArmFeel(IdMixin, CreatedAtMixin, Base): | |
| """Arm-feel reports; the newest one is the current feel.""" | |
| __tablename__ = "arm_feel_events" | |
| __table_args__ = ( | |
| CheckConstraint("feel IN ('sore', 'tight', 'good')", name="feel"), | |
| Index("ix_arm_feel_events_owner_id_created_at", "owner_id", text("created_at DESC")), | |
| ) | |
| owner_id: Mapped[uuid.UUID] = _owner() | |
| feel: Mapped[str] = mapped_column(String(8)) | |