feat: AI Worker 平台 MVP v1.0.0 - 多租户/项目管理/AI Worker/任务编排/HITL审核/成本治理
This commit is contained in:
@@ -0,0 +1,23 @@
|
|||||||
|
"""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}>"
|
||||||
Reference in New Issue
Block a user