Spaces:
Running on T4
Running on T4
Download backend/app/modules/billing/models.py from modventures/baseball-engine: direct link, hf CLI and curl.
- Browser
- Download file 1.26 kB
-
https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/backend/app/modules/billing/models.py
- Command line
-
hf download hf://spaces/modventures/baseball-engine/backend/app/modules/billing/models.py
-
curl -L -o models.py https://huggingface.co/spaces/modventures/baseball-engine/resolve/main/backend/app/modules/billing/models.py
1.26 kB
| import uuid | |
| from datetime import datetime | |
| from sqlalchemy import CheckConstraint, DateTime, ForeignKey, String, Text, func | |
| from sqlalchemy.dialects.postgresql import UUID | |
| from sqlalchemy.orm import Mapped, mapped_column | |
| from app.common.base_model import Base, IdMixin | |
| class Subscription(IdMixin, Base): | |
| """A store subscription. The account's plan is pro while an active row has expires_at in the future.""" | |
| __tablename__ = "subscriptions" | |
| __table_args__ = ( | |
| CheckConstraint("platform IN ('ios', 'android')", name="platform"), | |
| CheckConstraint("status IN ('active', 'grace', 'cancelled', 'expired', 'refunded')", name="status"), | |
| ) | |
| account_id: Mapped[uuid.UUID] = mapped_column( | |
| UUID(as_uuid=True), ForeignKey("accounts.id", ondelete="CASCADE"), index=True | |
| ) | |
| platform: Mapped[str] = mapped_column(String(8)) | |
| product_id: Mapped[str] = mapped_column(String(64)) | |
| original_transaction_id: Mapped[str] = mapped_column(Text, unique=True) | |
| status: Mapped[str] = mapped_column(String(10)) | |
| expires_at: Mapped[datetime] = mapped_column(DateTime(timezone=True)) | |
| updated_at: Mapped[datetime] = mapped_column( | |
| DateTime(timezone=True), server_default=func.now(), onupdate=func.now() | |
| ) | |