mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-08-30 12:36:55 +08:00
fix: 修复站点批量导入报错(重复方法覆盖导致异步调用失效)
This commit is contained in:
@@ -21,7 +21,7 @@ class SiteMutationRepository(Protocol):
|
||||
"""读取指定站点。"""
|
||||
...
|
||||
|
||||
async def get_by_domain(self, domain: str) -> Optional[Any]:
|
||||
async def async_get_by_domain(self, domain: str) -> Optional[Any]:
|
||||
"""按域名读取站点。"""
|
||||
...
|
||||
|
||||
@@ -90,7 +90,7 @@ class SiteMutationCommand:
|
||||
site_info = await self._indexer_loader(domain)
|
||||
if not site_info:
|
||||
return SiteMutationResult(False, "该站点不支持,请检查站点域名是否正确")
|
||||
if await self._repository.get_by_domain(domain):
|
||||
if await self._repository.async_get_by_domain(domain):
|
||||
return SiteMutationResult(False, f"{domain} 站点己存在")
|
||||
|
||||
values.update({
|
||||
|
||||
@@ -41,10 +41,6 @@ class SiteOper(DbOper):
|
||||
"""读取站点写用例需要的目标站点。"""
|
||||
return await self.async_get(site_id)
|
||||
|
||||
async def get_by_domain(self, domain: str) -> Optional[Site]:
|
||||
"""按域名读取站点写用例的重复目标。"""
|
||||
return await Site.async_get_by_domain(self._db, domain)
|
||||
|
||||
async def stage_create(self, payload: Mapping[str, Any]) -> None:
|
||||
"""暂存新增站点,不由仓储自行提交。"""
|
||||
values = dict(payload)
|
||||
|
||||
@@ -9,7 +9,7 @@ def _command(**overrides):
|
||||
"""构造可观察站点写用例及其依赖。"""
|
||||
repository = Mock()
|
||||
repository.get_by_id = AsyncMock(return_value=object())
|
||||
repository.get_by_domain = AsyncMock(return_value=None)
|
||||
repository.async_get_by_domain = AsyncMock(return_value=None)
|
||||
repository.stage_create = AsyncMock()
|
||||
repository.stage_update = AsyncMock(return_value=True)
|
||||
repository.stage_delete = AsyncMock()
|
||||
|
||||
Reference in New Issue
Block a user