Skip to content

Commit bae986d

Browse files
committed
made the requested change
1 parent e098c19 commit bae986d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/pwncore/routes/team.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,21 @@ async def get_team_containers(response: Response, jwt: RequireJwt):
122122
return result
123123

124124
@atomic()
125-
@router.post("team/{id}")
125+
@router.post("/team/{id}")
126126
async def upsert_table_tn(id: int, data: TableTNBody, request: Request, response: Response):
127127
admin_password = (await request.body()).strip()
128128

129129
if not bcrypt.verify(admin_password, ADMIN_HASH):
130-
response.status_code = 401
130+
response.status_code = 401
131+
132+
team = await Team.get_or_none(id=id)
133+
if not team:
134+
response.status_code = 404
135+
136+
try:
137+
team.table_tn = data.table_tn
138+
await team.save()
139+
except Exception:
140+
response.status_code = 500
141+
142+
return {"msg_code": "tabletn_upserted"}

0 commit comments

Comments
 (0)