refactor: make model sessions explicit

This commit is contained in:
jxxghp
2026-08-23 23:33:07 +08:00
parent 820582ab12
commit 6e69258e3c
65 changed files with 1299 additions and 2010 deletions
+3 -4
View File
@@ -1,9 +1,8 @@
"""把旧整理历史 Oper 的业务写入方法转交给应用服务。"""
from typing import Optional
from typing import Any, Optional
from app.application.history import add_transfer_fail, add_transfer_success
from app.db.models.transferhistory import TransferHistory
from app.db.oper.transferhistory import TransferHistoryOper as CanonicalTransferHistoryOper
from app.domain.context import MediaInfo, MusicInfo
from app.domain.meta.metabase import MetaBase
@@ -23,7 +22,7 @@ class TransferHistoryOper(CanonicalTransferHistoryOper):
transferinfo: TransferInfo,
downloader: Optional[str] = None,
download_hash: Optional[str] = None,
) -> Optional[TransferHistory]:
) -> Optional[Any]:
"""
按旧签名新增整理成功历史。
@@ -49,7 +48,7 @@ class TransferHistoryOper(CanonicalTransferHistoryOper):
transferinfo: Optional[TransferInfo] = None,
downloader: Optional[str] = None,
download_hash: Optional[str] = None,
) -> Optional[TransferHistory]:
) -> Optional[Any]:
"""
按旧签名新增整理失败历史。
+1 -2
View File
@@ -3,7 +3,6 @@
from typing import Any, Optional
from app.application.subscription.write import add_subscribe, async_add_subscribe
from app.db.models.subscribe import Subscribe
from app.db.oper.subscribe import SubscribeOper as CanonicalSubscribeOper
from app.domain.context import MediaInfo, MusicInfo
@@ -72,4 +71,4 @@ class SubscribeOper(CanonicalSubscribeOper):
)
__all__ = ["Subscribe", "SubscribeOper"]
__all__ = ["SubscribeOper"]
-2
View File
@@ -11,12 +11,10 @@ from app.api.deps import (
get_current_user_async,
)
from app.db.oper.user import UserOper
from app.db.models.user import User
__all__ = [
"UserOper",
"User",
"get_current_active_manage_user",
"get_current_active_manage_user_async",
"get_current_active_superuser",