refactor(api): use Annotated-style dependency injection

This commit is contained in:
MingxuanGame
2025-10-03 05:41:31 +00:00
parent 37b4eadf79
commit 346c2557cf
45 changed files with 623 additions and 577 deletions

View File

@@ -1,8 +1,15 @@
from __future__ import annotations
from app.service.beatmap_download_service import download_service
from typing import Annotated
from app.service.beatmap_download_service import BeatmapDownloadService, download_service
from fastapi import Depends
def get_beatmap_download_service():
"""获取谱面下载服务实例"""
return download_service
DownloadService = Annotated[BeatmapDownloadService, Depends(get_beatmap_download_service)]