From a6bd7a66894701693b5b493d38caabc8f05b1ab4 Mon Sep 17 00:00:00 2001 From: huangzhuang_3rd Date: Wed, 12 Aug 2026 13:30:44 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20AI=20Worker=20=E5=B9=B3=E5=8F=B0=20MVP?= =?UTF-8?q?=20v1.0.0=20-=20=E5=A4=9A=E7=A7=9F=E6=88=B7/=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E7=AE=A1=E7=90=86/AI=20Worker/=E4=BB=BB=E5=8A=A1=E7=BC=96?= =?UTF-8?q?=E6=8E=92/HITL=E5=AE=A1=E6=A0=B8/=E6=88=90=E6=9C=AC=E6=B2=BB?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/models/base.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 backend/app/models/base.py diff --git a/backend/app/models/base.py b/backend/app/models/base.py new file mode 100644 index 0000000..b5f3d84 --- /dev/null +++ b/backend/app/models/base.py @@ -0,0 +1,19 @@ +"""Base model and common mixins.""" +from datetime import datetime +from sqlalchemy import Column, Integer, DateTime, String +from app.database import Base + + +class TimestampMixin: + """Adds created_at and updated_at columns.""" + created_at = Column(DateTime, default=datetime.utcnow, nullable=False) + updated_at = Column(DateTime, default=datetime.utcnow, onupdate=datetime.utcnow, nullable=False) + + +class TenantMixin: + """Adds tenant_id column for multi-tenant isolation. + + Every domain model inherits this to guarantee row-level tenant isolation. + Queries must always filter by tenant_id. + """ + tenant_id = Column(Integer, nullable=False, index=True)