Files
ai-worker-platform/backend/app/models/tenant.py
T

24 lines
814 B
Python

"""Tenant model - top-level isolation boundary."""
from sqlalchemy import Column, String, Boolean, Text, Integer
from app.models.base import Base, TimestampMixin
class Tenant(Base, TimestampMixin):
"""A tenant represents an organization / department.
All data (users, projects, tasks, workers) is isolated by tenant_id.
"""
__tablename__ = "tenants"
id = Column(Integer, primary_key=True, autoincrement=True)
name = Column(String(200), nullable=False)
slug = Column(String(100), nullable=False, unique=True, index=True)
description = Column(Text, default="")
is_active = Column(Boolean, default=True, nullable=False)
# Tenant-level settings stored as JSON string
settings = Column(Text, default="{}")
def __repr__(self):
return f"<Tenant {self.slug}>"