From 8d59a69f48abd590301104f10319452c18fbd4ca Mon Sep 17 00:00:00 2001 From: Mir Arif Hasan Date: Thu, 27 Jul 2023 18:56:19 +0600 Subject: [PATCH] feat: remove EmptyClassProvider class --- packages/hoppscotch-backend/src/auth/auth.module.ts | 8 ++++---- packages/hoppscotch-backend/src/auth/helper.ts | 2 -- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/hoppscotch-backend/src/auth/auth.module.ts b/packages/hoppscotch-backend/src/auth/auth.module.ts index 8585635e8..e00917616 100644 --- a/packages/hoppscotch-backend/src/auth/auth.module.ts +++ b/packages/hoppscotch-backend/src/auth/auth.module.ts @@ -11,7 +11,7 @@ import { RTJwtStrategy } from './strategies/rt-jwt.strategy'; import { GoogleStrategy } from './strategies/google.strategy'; import { GithubStrategy } from './strategies/github.strategy'; import { MicrosoftStrategy } from './strategies/microsoft.strategy'; -import { EmptyClassProvider, authProviderCheck } from './helper'; +import { authProviderCheck } from './helper'; @Module({ imports: [ @@ -27,9 +27,9 @@ import { EmptyClassProvider, authProviderCheck } from './helper'; AuthService, JwtStrategy, RTJwtStrategy, - authProviderCheck('GOOGLE') ? GoogleStrategy : EmptyClassProvider, - authProviderCheck('GITHUB') ? GithubStrategy : EmptyClassProvider, - authProviderCheck('MICROSOFT') ? MicrosoftStrategy : EmptyClassProvider, + ...(authProviderCheck('GOOGLE') ? [GoogleStrategy] : []), + ...(authProviderCheck('GITHUB') ? [GithubStrategy] : []), + ...(authProviderCheck('MICROSOFT') ? [MicrosoftStrategy] : []), ], controllers: [AuthController], }) diff --git a/packages/hoppscotch-backend/src/auth/helper.ts b/packages/hoppscotch-backend/src/auth/helper.ts index d083bc7a8..5b4c08839 100644 --- a/packages/hoppscotch-backend/src/auth/helper.ts +++ b/packages/hoppscotch-backend/src/auth/helper.ts @@ -98,8 +98,6 @@ export const subscriptionContextCookieParser = (rawCookies: string) => { }; }; -export class EmptyClassProvider {} - /** * Check to see if given auth provider is present in the ALLOWED_AUTH_PROVIDERS env variable *