From b10f9245b638b7c7359473f7f132c10c000e58b2 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 3 May 2022 10:41:04 +0200 Subject: [PATCH] linting --- backend/src/graphql/resolver/UserResolver.ts | 13 ++++++------- backend/src/server/createServer.ts | 1 - backend/src/server/plugins.ts | 6 ++---- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/backend/src/graphql/resolver/UserResolver.ts b/backend/src/graphql/resolver/UserResolver.ts index e56158a6e..b578b15ae 100644 --- a/backend/src/graphql/resolver/UserResolver.ts +++ b/backend/src/graphql/resolver/UserResolver.ts @@ -26,7 +26,6 @@ import { hasElopageBuys } from '@/util/hasElopageBuys' log4js.configure(CONFIG.LOG4JS_CONFIG) const logger = log4js.getLogger('graphql.resolver.UserResolver') - // eslint-disable-next-line @typescript-eslint/no-var-requires const sodium = require('sodium-native') // eslint-disable-next-line @typescript-eslint/no-var-requires @@ -223,31 +222,31 @@ export class UserResolver { ): Promise { email = email.trim().toLowerCase() const dbUser = await DbUser.findOneOrFail({ email }, { withDeleted: true }).catch(() => { - logger.error('User does not exists with this email=' + email) + logger.error('User does not exists with this email=' + email) throw new Error('No user with this credentials') }) if (dbUser.deletedAt) { - logger.error('The User was permanently deleted in database. email=' + email) + logger.error('The User was permanently deleted in database. email=' + email) throw new Error('This user was permanently deleted. Contact support for questions.') } if (!dbUser.emailChecked) { - logger.error('The Users email is not validate yet. email=' + email) + logger.error('The Users email is not validate yet. email=' + email) throw new Error('User email not validated') } if (dbUser.password === BigInt(0)) { - logger.error('The User has not set a password yet. email=' + email) + logger.error('The User has not set a password yet. email=' + email) // TODO we want to catch this on the frontend and ask the user to check his emails or resend code throw new Error('User has no password set yet') } if (!dbUser.pubKey || !dbUser.privKey) { - logger.error('The User has no private or publicKey. email=' + email) + logger.error('The User has no private or publicKey. email=' + email) // TODO we want to catch this on the frontend and ask the user to check his emails or resend code throw new Error('User has no private or publicKey') } const passwordHash = SecretKeyCryptographyCreateKey(email, password) // return short and long hash const loginUserPassword = BigInt(dbUser.password.toString()) if (loginUserPassword !== passwordHash[0].readBigUInt64LE()) { - logger.error('The User has no valid credentials. email=' + email) + logger.error('The User has no valid credentials. email=' + email) throw new Error('No user with this credentials') } diff --git a/backend/src/server/createServer.ts b/backend/src/server/createServer.ts index ff5722ff0..d517865c9 100644 --- a/backend/src/server/createServer.ts +++ b/backend/src/server/createServer.ts @@ -38,7 +38,6 @@ logger.error('This little thing had roast beef') logger.fatal('This little thing had none') logger.trace('and this little thing went wee, wee, wee, all the way home.') - // eslint-disable-next-line @typescript-eslint/no-explicit-any const createServer = async (context: any = serverContext): Promise => { // open mysql connection diff --git a/backend/src/server/plugins.ts b/backend/src/server/plugins.ts index a58fe5609..d55f0e132 100644 --- a/backend/src/server/plugins.ts +++ b/backend/src/server/plugins.ts @@ -21,8 +21,6 @@ const setHeadersPlugin = { // const requestDidStartLog = (requestContext: any): void => { - - // } const logPlugin = { @@ -33,8 +31,8 @@ const logPlugin = { return { willSendResponse(requestContext: any) { // console.log(requestContext) - logger.trace('Response-Data:' + JSON.stringify(requestContext.response.errors, null, 2)) - logger.trace('Response-Errors:' + JSON.stringify(requestContext.response.data, null, 2)) + logger.trace('Response-Data:' + JSON.stringify(requestContext.response.errors, null, 2)) + logger.trace('Response-Errors:' + JSON.stringify(requestContext.response.data, null, 2)) return requestContext }, }