diff --git a/app/schemas/history.py b/app/schemas/history.py index a74a8ca9c..ba9cdc229 100644 --- a/app/schemas/history.py +++ b/app/schemas/history.py @@ -73,6 +73,10 @@ class TransferHistory(OptionalMediaIdentityMixin, BaseModel): src_storage: Optional[str] = None # 目标存储类型 dest_storage: Optional[str] = None + # 源文件项(含文件大小等运行时字段,与 to_dict 直出保持一致) + src_fileitem: Optional[JsonData] = None + # 目标文件项 + dest_fileitem: Optional[JsonData] = None # 源目录 src: Optional[str] = None # 目的目录 @@ -121,6 +125,8 @@ class TransferHistory(OptionalMediaIdentityMixin, BaseModel): errmsg: Optional[str] = None # 日期 date: Optional[str] = None + # 文件清单 + files: Optional[JsonData] = None model_config = ConfigDict(from_attributes=True) diff --git a/tests/test_explicit_response_models.py b/tests/test_explicit_response_models.py index 7e0c129c4..8dce44482 100644 --- a/tests/test_explicit_response_models.py +++ b/tests/test_explicit_response_models.py @@ -50,9 +50,15 @@ def test_stable_collections_serialize_without_changing_payload_shape(): dest_storage="alist", src="/downloads/demo.mkv", dest="/media/demo.mkv", + src_fileitem={"path": "/downloads/demo.mkv", "size": 1024}, + dest_fileitem={"path": "/media/demo.mkv", "size": 1024}, + files=[{"path": "/downloads/demo.mkv"}], ).model_dump() assert history["src_storage"] == "local" assert history["dest_storage"] == "alist" + assert history["src_fileitem"]["size"] == 1024 + assert history["dest_fileitem"]["size"] == 1024 + assert history["files"][0]["path"] == "/downloads/demo.mkv" assert episode.model_dump()["crew"][0]["job"] == "Writer" assert episode.model_dump()["guest_stars"][0]["character"] == "Guest"