formatting

This commit is contained in:
Ajay Ramachandran 2021-12-19 19:13:49 -05:00 committed by GitHub
parent 544af7ce15
commit 0f4b0c2f54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -70,8 +70,11 @@ export async function setUsername(req: Request, res: Response): Promise<Response
if (row?.userName !== undefined) {
//already exists, update this row
oldUserName = row.userName;
if (userName == userID && !locked) await db.prepare("run", `DELETE FROM "userNames" WHERE "userID" = ?`, [userID]);
else await db.prepare("run", `UPDATE "userNames" SET "userName" = ?, "locked" = ? WHERE "userID" = ?`, [userName, locked, userID]);
if (userName == userID && !locked) {
await db.prepare("run", `DELETE FROM "userNames" WHERE "userID" = ?`, [userID]);
} else {
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]);