From f83533187985e89e83e9f660b43e111704e29de3 Mon Sep 17 00:00:00 2001 From: huangzhuang_3rd Date: Wed, 12 Aug 2026 13:30:53 +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/schemas/common.py | 44 +++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 backend/app/schemas/common.py diff --git a/backend/app/schemas/common.py b/backend/app/schemas/common.py new file mode 100644 index 0000000..55795f8 --- /dev/null +++ b/backend/app/schemas/common.py @@ -0,0 +1,44 @@ +"""Common shared schemas.""" +from typing import Optional, Any, List, Generic, TypeVar +from pydantic import BaseModel +from datetime import datetime + +T = TypeVar("T") + + +class PaginatedResponse(BaseModel, Generic[T]): + """Generic paginated response wrapper.""" + items: List[T] + total: int + page: int = 1 + page_size: int = 20 + + +class SuccessResponse(BaseModel): + """Simple success response.""" + success: bool = True + message: str = "" + data: Optional[Any] = None + + +class TokenResponse(BaseModel): + """JWT token response.""" + access_token: str + token_type: str = "bearer" + user: "UserBrief" + + +class UserBrief(BaseModel): + """Brief user info embedded in responses.""" + id: int + username: str + email: str + role: str + user_type: str + tenant_id: int + + model_config = {"from_attributes": True} + + +# Update forward refs +TokenResponse.model_rebuild()