mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-11-03 05:44:44 +08:00
fix: 修正精确搜索与模糊搜索的 response_model
/search/media/{media_id} 与 /search/title 的 response_model 声明为
Response[list[TorrentInfo]],而 SearchChain.async_search_by_id 与
async_search_by_title 实际返回的是 List[Context]。
Context.to_dict() 产出 {meta_info, media_info, torrent_info} 三层结构,
与 TorrentInfo 的字段完全不相交,被 pydantic 按 response_model 序列化后
所有字段都变成 null,接口对外返回一批空壳数据。
改为与同文件 /search/last 一致的 List[_SchemaContext],
由 ResponseAPIRouter 统一包装成 Response[List[Context]]。
This commit is contained in:
@@ -432,7 +432,7 @@ async def search_by_id_stream(
|
||||
@router.get(
|
||||
"/media/{media_id}",
|
||||
summary="精确搜索资源",
|
||||
response_model=_SchemaResponse[list[_SchemaTorrentInfo]],
|
||||
response_model=List[_SchemaContext],
|
||||
)
|
||||
async def search_by_id(
|
||||
media_id: str,
|
||||
@@ -513,7 +513,7 @@ async def search_by_title_stream(
|
||||
@router.get(
|
||||
"/title",
|
||||
summary="模糊搜索资源",
|
||||
response_model=_SchemaResponse[list[_SchemaTorrentInfo]],
|
||||
response_model=List[_SchemaContext],
|
||||
)
|
||||
async def search_by_title(
|
||||
keyword: Optional[str] = None,
|
||||
|
||||
Reference in New Issue
Block a user