Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
chore(backend): cleanup code quality issues (#5466)
Abhishek3880dd8744f292b9
diff --git a/packages/hoppscotch-backend/src/auth/auth.controller.ts b/packages/hoppscotch-backend/src/auth/auth.controller.tsindex c713dad5d..be0a0a314 100644--- a/packages/hoppscotch-backend/src/auth/auth.controller.ts+++ b/packages/hoppscotch-backend/src/auth/auth.controller.ts@@ -22,7 +22,7 @@ import { RTCookie } from 'src/decorators/rt-cookie.decorator';import { AuthProvider, authCookieHandler, authProviderCheck } from './helper';import { GoogleSSOGuard } from './guards/google-sso.guard';import { GithubSSOGuard } from './guards/github-sso.guard';-import { MicrosoftSSOGuard } from './guards/microsoft-sso-.guard';+import { MicrosoftSSOGuard } from './guards/microsoft-sso.guard';import { ThrottlerBehindProxyGuard } from 'src/guards/throttler-behind-proxy.guard';import { SkipThrottle } from '@nestjs/throttler';import { AUTH_PROVIDER_NOT_SPECIFIED } from 'src/errors';diff --git a/packages/hoppscotch-backend/src/auth/guards/microsoft-sso-.guard.ts b/packages/hoppscotch-backend/src/auth/guards/microsoft-sso.guard.tssimilarity index 100%rename from packages/hoppscotch-backend/src/auth/guards/microsoft-sso-.guard.tsrename to packages/hoppscotch-backend/src/auth/guards/microsoft-sso.guard.tsdiff --git a/packages/hoppscotch-backend/src/errors.ts b/packages/hoppscotch-backend/src/errors.tsindex 435cc42a5..817f1afe0 100644--- a/packages/hoppscotch-backend/src/errors.ts+++ b/packages/hoppscotch-backend/src/errors.ts@@ -22,19 +22,19 @@ export const ADMIN_CAN_NOT_BE_DELETED =* Token Authorization failed (Check 'Authorization' Header)* (GqlAuthGuard)*/-export const AUTH_FAIL = 'auth/fail';+export const AUTH_FAIL = 'auth/fail' as const;/*** Invalid JSON* (Utils)*/-export const JSON_INVALID = 'json_invalid';+export const JSON_INVALID = 'json_invalid' as const;/*** Auth Provider not specified* (Auth)*/-export const AUTH_PROVIDER_NOT_SPECIFIED = 'auth/provider_not_specified';+export const AUTH_PROVIDER_NOT_SPECIFIED = 'auth/provider_not_specified' as const;/*** Email not provided by OAuth provider@@ -168,7 +168,7 @@ export const TEAM_NOT_REQUIRED_ROLE = 'team/not_required_role' as const;* Team name validation failure* (TeamService)*/-export const TEAM_NAME_INVALID = 'team/name_invalid';+export const TEAM_NAME_INVALID = 'team/name_invalid' as const;/*** Couldn't find the sync data from the user@@ -432,7 +432,6 @@ export const USER_ENVIRONMENT_GLOBAL_ENV_DOES_NOT_EXISTS =*/export const USER_ENVIRONMENT_GLOBAL_ENV_EXISTS ='user_environment/global_env_already_exists' as const;-/*/*** User environment doesn't exist for the user@@ -440,7 +439,6 @@ export const USER_ENVIRONMENT_GLOBAL_ENV_EXISTS =*/export const USER_ENVIRONMENT_ENV_DOES_NOT_EXISTS ='user_environment/user_env_does_not_exists' as const;-/*/*** Cannot delete the global user environment@@ -448,7 +446,6 @@ export const USER_ENVIRONMENT_ENV_DOES_NOT_EXISTS =*/export const USER_ENVIRONMENT_GLOBAL_ENV_DELETION_FAILED ='user_environment/user_env_global_env_deletion_failed' as const;-/*/*** User environment is not a global environment@@ -456,7 +453,6 @@ export const USER_ENVIRONMENT_GLOBAL_ENV_DELETION_FAILED =*/export const USER_ENVIRONMENT_IS_NOT_GLOBAL ='user_environment/user_env_is_not_global' as const;-/*/*** User environment update failed@@ -464,7 +460,6 @@ export const USER_ENVIRONMENT_IS_NOT_GLOBAL =*/export const USER_ENVIRONMENT_UPDATE_FAILED ='user_environment/user_env_update_failed' as const;-/*/*** User environment invalid environment name@@ -472,7 +467,6 @@ export const USER_ENVIRONMENT_UPDATE_FAILED =*/export const USER_ENVIRONMENT_INVALID_ENVIRONMENT_NAME ='user_environment/user_env_invalid_env_name' as const;-/*/*** User history not founddiff --git a/packages/hoppscotch-backend/src/main.ts b/packages/hoppscotch-backend/src/main.tsindex 05398c591..3dd118125 100644--- a/packages/hoppscotch-backend/src/main.ts+++ b/packages/hoppscotch-backend/src/main.ts@@ -12,7 +12,7 @@ import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';import { InfraTokenModule } from './infra-token/infra-token.module';import { NestExpressApplication } from '@nestjs/platform-express';-function setupSwagger(app, isProduction: boolean) {+function setupSwagger(app: NestExpressApplication, isProduction: boolean): void {const swaggerDocPath = '/api-docs';const config = new DocumentBuilder()