Kaynağa Gözat

去除无用字段

liujintao 1 ay önce
ebeveyn
işleme
1dd0e508ee
2 değiştirilmiş dosya ile 3 ekleme ve 7 silme
  1. 2 4
      app/routers/search.py
  2. 1 3
      app/schemas.py

+ 2 - 4
app/routers/search.py

@@ -32,16 +32,14 @@ async def _do_search(req: SearchRequest) -> ApiResponse[SearchData]:
             per_page=req.per_page,
         )
     except ZendeskError as exc:
-        raise BusinessError(ResponseCode.UPSTREAM_ERROR, msg=str(exc)) from exc
+        raise BusinessError(ResponseCode.UPSTREAM_ERROR) from exc
 
     return ApiResponse.ok(
         data=SearchData(
-            query=req.query,
             count=int(data.get("count", 0)),
             page=req.page,
             per_page=req.per_page,
-            next_page=data.get("next_page"),
-            sec_ids_used=sec_ids,
+            is_next_page=bool(data.get("next_page")),
             results=data.get("results", []),
         )
     )

+ 1 - 3
app/schemas.py

@@ -20,12 +20,10 @@ class SearchRequest(BaseModel):
 class SearchData(BaseModel):
     """搜索响应数据(放入 ApiResponse.data 字段)。"""
 
-    query: str
     count: int
     page: int
     per_page: int
-    next_page: str | None = None
-    sec_ids_used: list[int]
+    is_next_page: bool
     results: list[dict[str, Any]]