fix(team): modifying name or short name doesn't work

This commit is contained in:
MingxuanGame
2025-08-28 09:54:02 +00:00
parent 7a0283086d
commit d1fc10626b
2 changed files with 11 additions and 6 deletions

View File

@@ -102,12 +102,16 @@ async def update_team(
if team.leader_id != user_id:
raise HTTPException(status_code=403, detail="You are not the team leader")
is_existed = (await session.exec(select(exists()).where(Team.name == name))).first()
if is_existed:
raise HTTPException(status_code=409, detail="Name already exists")
is_existed = (await session.exec(select(exists()).where(Team.short_name == short_name))).first()
if is_existed:
raise HTTPException(status_code=409, detail="Short name already exists")
if name is not None:
if (await session.exec(select(exists()).where(Team.name == name))).first():
raise HTTPException(status_code=409, detail="Name already exists")
else:
team.name = name
if short_name is not None:
if (await session.exec(select(exists()).where(Team.short_name == short_name))).first():
raise HTTPException(status_code=409, detail="Short name already exists")
else:
team.short_name = short_name
if flag:
check_image(flag, 2 * 1024 * 1024, 240, 120)

1
spectator-server Submodule

Submodule spectator-server added at 27d49c8925