generated from Arquisoft/wiq_0
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
59 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,17 +9,20 @@ let UserController = { | |
|
||
for (const p of players) { | ||
try { | ||
const user = await User.findOne({ uuid: p.uuid }); | ||
let user; | ||
Check failure Code scanning / SonarCloud NoSQL operations should not be vulnerable to injection attacks High
Change this code to not construct database queries directly from user-controlled data. See more on SonarCloud
|
||
if(p.uuid instanceof String){ | ||
user = await User.findOne({ uuid: p.uuid }); | ||
|
||
if (user) { | ||
user.lastGameId = gameUUID; | ||
await user.save(); | ||
} else { | ||
console.error(`User with UUID ${p.uuid} not found.`); | ||
} | ||
}} | ||
} catch (error) { | ||
console.error(`Error updating last game for user with UUID ${p.uuid}: ${error.message}`); | ||
} | ||
|
||
} | ||
|
||
const nPlayers = players.length; | ||
|