feat: add support for pagination responses

also fix check-in error messages not displaying
This commit is contained in:
2026-01-06 21:30:19 +08:00
parent 63b4935fce
commit 2626477b0d
7 changed files with 142 additions and 41 deletions
+11 -1
View File
@@ -1,7 +1,9 @@
from datetime import datetime
from typing import Optional
from typing import Optional, List, Generic, TypeVar
from pydantic import BaseModel, Field, ConfigDict
T = TypeVar('T')
class ManualCheckInRequest(BaseModel):
"""手动打卡请求 Schema(已废弃,现在使用路径参数 task_id)"""
@@ -46,3 +48,11 @@ class CheckInResultResponse(BaseModel):
message: str
record_id: Optional[int] = None
error: Optional[str] = None
class PaginatedResponse(BaseModel, Generic[T]):
"""分页响应 Schema"""
records: List[T] = Field(..., description="记录列表")
total: int = Field(..., description="总记录数")
skip: int = Field(..., description="跳过的记录数")
limit: int = Field(..., description="每页记录数")