mirror of
https://github.com/Cccc-owo/CheckInApp.git
synced 2026-06-17 05:56:29 +00:00
refactor(structure): reorganize app layout
BREAKING CHANGE: root backend/frontend directories and old run/manage entrypoints were removed. Use apps/backend, apps/frontend, and python main.py commands instead.
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
"""
|
||||
统一的 API 响应 Schema
|
||||
"""
|
||||
from typing import Generic, TypeVar, Optional
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
T = TypeVar('T')
|
||||
|
||||
|
||||
class ApiResponse(BaseModel, Generic[T]):
|
||||
"""统一成功响应"""
|
||||
success: bool = True
|
||||
data: Optional[T] = None
|
||||
message: Optional[str] = None
|
||||
|
||||
|
||||
class ErrorDetail(BaseModel):
|
||||
"""错误详情"""
|
||||
code: str
|
||||
message: str
|
||||
field: Optional[str] = None # 字段验证错误时使用
|
||||
|
||||
|
||||
class ErrorResponse(BaseModel):
|
||||
"""统一错误响应"""
|
||||
success: bool = False
|
||||
error: ErrorDetail
|
||||
Reference in New Issue
Block a user