From a9d0ae4ae7755f56f59925d9eff1b346bcbffed9 Mon Sep 17 00:00:00 2001 From: Tsu-ba-me Date: Tue, 6 Jun 2023 20:41:58 -0400 Subject: [PATCH] fix(striker-ui-api): don't consider name of deleted users as used --- striker-ui-api/src/lib/request_handlers/user/createUser.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/striker-ui-api/src/lib/request_handlers/user/createUser.ts b/striker-ui-api/src/lib/request_handlers/user/createUser.ts index ecf8bcc9..7628c6b1 100644 --- a/striker-ui-api/src/lib/request_handlers/user/createUser.ts +++ b/striker-ui-api/src/lib/request_handlers/user/createUser.ts @@ -1,7 +1,7 @@ import assert from 'assert'; import { RequestHandler } from 'express'; -import { REP_PEACEFUL_STRING, REP_UUID } from '../../consts'; +import { DELETED, REP_PEACEFUL_STRING, REP_UUID } from '../../consts'; import { insertOrUpdateUser, query } from '../../accessModule'; import { sanitize } from '../../sanitize'; @@ -33,7 +33,9 @@ export const createUser: RequestHandler< ); const [[userCount]]: [[number]] = await query( - `SELECT COUNT(user_uuid) FROM users WHERE user_name = '${userName}';`, + `SELECT COUNT(user_uuid) + FROM users + WHERE user_algorithm != '${DELETED}' AND user_name = '${userName}';`, ); assert(userCount === 0, `User name [${userName}] already used`);