Download app/models/source.py from angeetoile/waste_classifier_robiatech: direct link, hf CLI and curl.
- Browser
- Download file 2.55 kB
-
https://huggingface.co/spaces/angeetoile/waste_classifier_robiatech/resolve/main/app/models/source.py
- Command line
-
hf download hf://spaces/angeetoile/waste_classifier_robiatech/app/models/source.py
-
curl -L -o source.py https://huggingface.co/spaces/angeetoile/waste_classifier_robiatech/resolve/main/app/models/source.py
2.55 kB
| import uuid | |
| from datetime import datetime | |
| from sqlalchemy import ( | |
| Boolean, | |
| DateTime, | |
| Index, | |
| String, | |
| Text, | |
| func, | |
| ) | |
| from sqlalchemy.dialects.postgresql import UUID | |
| from sqlalchemy.orm import Mapped, mapped_column, relationship | |
| from app.db.base import Base | |
| class Source(Base): | |
| __tablename__ = "sources" | |
| id: Mapped[uuid.UUID] = mapped_column( | |
| UUID(as_uuid=True), | |
| primary_key=True, | |
| default=uuid.uuid4, | |
| ) | |
| name: Mapped[str] = mapped_column( | |
| String(180), | |
| nullable=False, | |
| unique=True, | |
| ) | |
| slug: Mapped[str] = mapped_column( | |
| String(180), | |
| nullable=False, | |
| unique=True, | |
| ) | |
| organization_type: Mapped[str] = mapped_column( | |
| String(50), | |
| nullable=False, | |
| default="organization", | |
| server_default="organization", | |
| ) | |
| base_url: Mapped[str] = mapped_column( | |
| Text, | |
| nullable=False, | |
| ) | |
| opportunities_url: Mapped[str | None] = mapped_column( | |
| Text, | |
| nullable=True, | |
| ) | |
| feed_url: Mapped[str | None] = mapped_column( | |
| Text, | |
| nullable=True, | |
| ) | |
| logo_url: Mapped[str | None] = mapped_column( | |
| Text, | |
| nullable=True, | |
| ) | |
| country_code: Mapped[str | None] = mapped_column( | |
| String(2), | |
| nullable=True, | |
| ) | |
| source_tier: Mapped[str] = mapped_column( | |
| String(1), | |
| nullable=False, | |
| default="B", | |
| server_default="B", | |
| ) | |
| is_official: Mapped[bool] = mapped_column( | |
| Boolean, | |
| nullable=False, | |
| default=True, | |
| server_default="true", | |
| ) | |
| is_active: Mapped[bool] = mapped_column( | |
| Boolean, | |
| nullable=False, | |
| default=True, | |
| server_default="true", | |
| ) | |
| last_checked_at: Mapped[datetime | None] = mapped_column( | |
| DateTime(timezone=True), | |
| nullable=True, | |
| ) | |
| created_at: Mapped[datetime] = mapped_column( | |
| DateTime(timezone=True), | |
| nullable=False, | |
| server_default=func.now(), | |
| ) | |
| updated_at: Mapped[datetime] = mapped_column( | |
| DateTime(timezone=True), | |
| nullable=False, | |
| server_default=func.now(), | |
| onupdate=func.now(), | |
| ) | |
| opportunities = relationship( | |
| "Opportunity", | |
| back_populates="source", | |
| lazy="selectin", | |
| ) | |
| __table_args__ = ( | |
| Index("ix_sources_slug", "slug"), | |
| Index( | |
| "ix_sources_active_official", | |
| "is_active", | |
| "is_official", | |
| ), | |
| ) |