Download src/models/organization.py from arimatch1/crewhub: direct link, hf CLI and curl.
- Browser
- Download file 1.46 kB
-
https://huggingface.co/spaces/arimatch1/crewhub/resolve/main/src/models/organization.py
- Command line
-
hf download hf://spaces/arimatch1/crewhub/src/models/organization.py
-
curl -L -o organization.py https://huggingface.co/spaces/arimatch1/crewhub/resolve/main/src/models/organization.py
1.46 kB
| # Copyright (c) 2026 CrewHub. All rights reserved. | |
| # Proprietary and confidential. See LICENSE for details. | |
| """Organization model for multi-tenancy.""" | |
| import uuid | |
| from datetime import datetime | |
| from sqlalchemy import DateTime, String, Uuid, func | |
| from sqlalchemy.orm import Mapped, mapped_column, relationship | |
| from src.database import Base | |
| class Organization(Base): | |
| __tablename__ = "organizations" | |
| id: Mapped[uuid.UUID] = mapped_column( | |
| Uuid, primary_key=True, default=uuid.uuid4 | |
| ) | |
| name: Mapped[str] = mapped_column(String(255), nullable=False) | |
| slug: Mapped[str] = mapped_column(String(255), unique=True, nullable=False, index=True) | |
| avatar_url: Mapped[str | None] = mapped_column(String(2048), nullable=True) | |
| created_at: Mapped[datetime] = mapped_column( | |
| DateTime(timezone=True), server_default=func.now(), nullable=False | |
| ) | |
| updated_at: Mapped[datetime] = mapped_column( | |
| DateTime(timezone=True), server_default=func.now(), onupdate=func.now(), nullable=False | |
| ) | |
| # Relationships | |
| teams: Mapped[list["Team"]] = relationship( | |
| "Team", back_populates="organization", lazy="selectin", cascade="all, delete-orphan" | |
| ) | |
| memberships: Mapped[list["Membership"]] = relationship( | |
| "Membership", back_populates="organization", lazy="noload", cascade="all, delete-orphan" | |
| ) | |
| def __repr__(self) -> str: | |
| return f"<Organization(id={self.id}, name={self.name})>" | |