Update backend/src/graphql/resolver/util/validateAlias.ts

Co-authored-by: Ulf Gebhardt <ulf.gebhardt@webcraft-media.de>
This commit is contained in:
Moriz Wahl 2023-05-10 18:39:41 +02:00 committed by GitHub
parent c78691c87c
commit dbe752563b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,7 +21,7 @@ const reservedAlias = [
'var', 'var',
] ]
export const validateAlias = async (alias: string): Promise<void> => { export const validateAlias = async (alias: string): Promise<boolean> => {
if (alias.length < 3) throw new LogError('Given alias is too short', alias) if (alias.length < 3) throw new LogError('Given alias is too short', alias)
if (alias.length > 20) throw new LogError('Given alias is too long', alias) if (alias.length > 20) throw new LogError('Given alias is too long', alias)
/* eslint-disable-next-line security/detect-unsafe-regex */ /* eslint-disable-next-line security/detect-unsafe-regex */
@ -34,4 +34,5 @@ export const validateAlias = async (alias: string): Promise<void> => {
if (aliasInUse.length !== 0) { if (aliasInUse.length !== 0) {
throw new LogError('Alias already in use', alias) throw new LogError('Alias already in use', alias)
} }
return true
} }