fix(team): modifying name or short name doesn't work
This commit is contained in:
@@ -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
1
spectator-server
Submodule
Submodule spectator-server added at 27d49c8925
Reference in New Issue
Block a user