prevent uploading kills to a match that's closed
This commit is contained in:
+14
-1
@@ -100,7 +100,7 @@ router.post(
|
||||
} = req.body;
|
||||
const match = await db
|
||||
.selectFrom("ToneAPI_v3.match")
|
||||
.select(["ToneAPI_v3.match.host_id", "ToneAPI_v3.match.match_id"])
|
||||
.select(["ToneAPI_v3.match.ongoing", "ToneAPI_v3.match.match_id"])
|
||||
.where("ToneAPI_v3.match.host_id", "=", host_id)
|
||||
.where("ToneAPI_v3.match.match_id", "=", match_id)
|
||||
.executeTakeFirst();
|
||||
@@ -116,6 +116,19 @@ router.post(
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
if(!match.ongoing){
|
||||
res.status(409).send({
|
||||
errors: [
|
||||
{
|
||||
msg: "Match is already closed",
|
||||
param: "match_id",
|
||||
location: "body",
|
||||
},
|
||||
],
|
||||
});
|
||||
return;
|
||||
}
|
||||
let attacker_loadout: number | undefined;
|
||||
let victim_loadout: number | undefined;
|
||||
await Promise.all([
|
||||
|
||||
Reference in New Issue
Block a user