mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 23:47:41 +08:00
feat(plugin): persist declared metadata snapshots (#6467)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
"""插件来源身份的数据访问原语。"""
|
||||
|
||||
from collections.abc import Sequence
|
||||
from typing import cast
|
||||
|
||||
from sqlalchemy import select, update
|
||||
@@ -25,6 +26,23 @@ class PluginIdentityOper(DbOper):
|
||||
)
|
||||
)
|
||||
|
||||
def list_by_plugin_ids(
|
||||
self,
|
||||
plugin_ids: Sequence[str],
|
||||
) -> list[PluginIdentity]:
|
||||
"""批量读取规范化物理插件 ID 对应的身份。"""
|
||||
if not plugin_ids:
|
||||
return []
|
||||
return list(
|
||||
self._execute_sync_query(
|
||||
lambda session: session.execute(
|
||||
select(PluginIdentity).where(
|
||||
PluginIdentity.normalized_plugin_id.in_(plugin_ids)
|
||||
)
|
||||
).scalars()
|
||||
)
|
||||
)
|
||||
|
||||
def stage_create(self, identity: PluginIdentity) -> None:
|
||||
"""暂存首次身份并立即暴露数据库唯一键竞争。"""
|
||||
def stage(session: Session) -> None:
|
||||
|
||||
Reference in New Issue
Block a user