feat(tools): add tools to add daily-challenge

This commit is contained in:
MingxuanGame
2025-08-20 08:59:14 +00:00
parent f1b0fa2c89
commit 6ac9a124ea
4 changed files with 104 additions and 23 deletions

View File

@@ -22,7 +22,7 @@ from app.dependencies.database import with_db
from app.dependencies.fetcher import get_fetcher
from app.exception import InvokeException
from .mods import APIMod
from .mods import API_MODS, APIMod
from .room import (
DownloadState,
MatchType,
@@ -121,19 +121,9 @@ class PlaylistItem(BaseModel):
star_rating: float
freestyle: bool
def _get_api_mods(self):
from app.models.mods import API_MODS, init_mods
if not API_MODS:
init_mods()
return API_MODS
def _validate_mod_for_ruleset(
self, mod: APIMod, ruleset_key: int, context: str = "mod"
) -> None:
from typing import Literal, cast
API_MODS = self._get_api_mods()
typed_ruleset_key = cast(Literal[0, 1, 2, 3], ruleset_key)
# Check if mod is valid for ruleset