chore(deps): auto fix by pre-commit hooks

This commit is contained in:
pre-commit-ci[bot]
2025-08-24 03:18:58 +00:00
committed by MingxuanGame
parent b4fd4e0256
commit 7625cd99f5
25 changed files with 241 additions and 320 deletions

View File

@@ -13,8 +13,8 @@ from app.dependencies.geoip import get_client_ip, get_geoip_helper
from app.dependencies.user import get_client_user, get_current_user
from app.fetcher import Fetcher
from app.models.beatmap import SearchQueryModel
from app.service.beatmap_download_service import BeatmapDownloadService
from app.service.asset_proxy_helper import process_response_assets
from app.service.beatmap_download_service import BeatmapDownloadService
from .router import router
@@ -97,7 +97,7 @@ async def search_beatmapset(
try:
sets = await fetcher.search_beatmapset(query, cursor, redis)
background_tasks.add_task(_save_to_db, sets)
# 处理资源代理
processed_sets = await process_response_assets(sets, request)
return processed_sets
@@ -121,7 +121,7 @@ async def lookup_beatmapset(
):
beatmap = await Beatmap.get_or_fetch(db, fetcher, bid=beatmap_id)
resp = await BeatmapsetResp.from_db(beatmap.beatmapset, session=db, user=current_user)
# 处理资源代理
processed_resp = await process_response_assets(resp, request)
return processed_resp

View File

@@ -56,20 +56,22 @@ async def get_all_rooms(
db_category = category
where_clauses: list[ColumnElement[bool]] = [col(Room.category) == db_category]
now = utcnow()
if status is not None:
where_clauses.append(col(Room.status) == status)
#print(mode, category, status, current_user.id)
# print(mode, category, status, current_user.id)
if mode == "open":
# 修改为新的查询逻辑:状态为 idle 或 playingstarts_at 不为空ends_at 为空
where_clauses.extend([
col(Room.status).in_([RoomStatus.IDLE, RoomStatus.PLAYING]),
col(Room.starts_at).is_not(None),
col(Room.ends_at).is_(None)
])
#if category == RoomCategory.REALTIME:
where_clauses.extend(
[
col(Room.status).in_([RoomStatus.IDLE, RoomStatus.PLAYING]),
col(Room.starts_at).is_not(None),
col(Room.ends_at).is_(None),
]
)
# if category == RoomCategory.REALTIME:
# where_clauses.append(col(Room.id).in_(MultiplayerHubs.rooms.keys()))
if mode == "participated":
where_clauses.append(
exists().where(
@@ -77,10 +79,10 @@ async def get_all_rooms(
col(RoomParticipatedUser.user_id) == current_user.id,
)
)
if mode == "owned":
where_clauses.append(col(Room.host_id) == current_user.id)
if mode == "ended":
where_clauses.append((col(Room.ends_at).is_not(None)) & (col(Room.ends_at) < now.replace(tzinfo=UTC)))
@@ -96,7 +98,7 @@ async def get_all_rooms(
.unique()
.all()
)
#print("Retrieved rooms:", db_rooms)
# print("Retrieved rooms:", db_rooms)
for room in db_rooms:
resp = await RoomResp.from_db(room, db)
resp.has_password = bool((room.password or "").strip())
@@ -424,4 +426,4 @@ async def get_room_events(
playlist_items=playlist_items_resps,
room=room_resp,
user=user_resps,
)
)