Step 12:后端轻量优化(API 稳定性 & 前端友好)
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
from typing import Generic, TypeVar
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic.generics import GenericModel
|
||||
|
||||
T = TypeVar("T")
|
||||
|
||||
|
||||
class PaginatedResponse(GenericModel, Generic[T]):
|
||||
items: list[T]
|
||||
total: int
|
||||
|
||||
|
||||
class MessageResponse(BaseModel):
|
||||
code: str
|
||||
message: str
|
||||
Reference in New Issue
Block a user