mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2024-11-10 01:02:30 +01:00
Switch username update to one query
This commit is contained in:
parent
8b54e965a2
commit
6f18a49ba0
1 changed files with 1 additions and 2 deletions
|
@ -69,8 +69,7 @@ export async function setUsername(req: Request, res: Response) {
|
|||
if (row.userName && row.userName.length !== 0) {
|
||||
//already exists, update this row
|
||||
oldUserName = row.userName;
|
||||
await db.prepare('run', `UPDATE "userNames" SET "userName" = ? WHERE "userID" = ?`, [userName, userID]);
|
||||
await db.prepare('run', `UPDATE "userNames" SET "locked" = ? WHERE "userID" = ?`, [locked, userID]);
|
||||
await db.prepare('run', `UPDATE "userNames" SET "userName" = ?, "locked" = ? WHERE "userID" = ?`, [userName, locked, userID]);
|
||||
} else {
|
||||
//add to the db
|
||||
await db.prepare('run', `INSERT INTO "userNames"("userID", "userName", "locked") VALUES(?, ?, ?)`, [userID, userName, locked]);
|
||||
|
|
Loading…
Reference in a new issue