-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "backend/DANG-1268: OAuth 리팩토링"
- Loading branch information
Showing
4 changed files
with
78 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,13 @@ | ||
import { HttpModule } from '@nestjs/axios'; | ||
import { Module, Type } from '@nestjs/common'; | ||
import { Module } from '@nestjs/common'; | ||
|
||
import { GoogleService } from './google.service'; | ||
import { KakaoService } from './kakao.service'; | ||
import { NaverService } from './naver.service'; | ||
import { OauthService } from './oauth.service.interface'; | ||
|
||
export const OAUTH_REGISTRY = new Map<string, Type<OauthService>>([ | ||
['google', GoogleService], | ||
['kakao', KakaoService], | ||
['naver', NaverService], | ||
]); | ||
|
||
@Module({ | ||
imports: [HttpModule], | ||
providers: [ | ||
{ | ||
provide: 'OAUTH_SERVICES', | ||
useFactory: () => { | ||
const oauthServices = new Map<string, OauthService>(); | ||
|
||
for (const [provider, ServiceClass] of OAUTH_REGISTRY) { | ||
oauthServices.set(provider, new ServiceClass()); | ||
} | ||
|
||
return oauthServices; | ||
}, | ||
}, | ||
GoogleService, | ||
KakaoService, | ||
NaverService, | ||
], | ||
exports: ['OAUTH_SERVICES'], | ||
providers: [GoogleService, KakaoService, NaverService], | ||
exports: [GoogleService, KakaoService, NaverService], | ||
}) | ||
export class OauthModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
import { OAUTH_REGISTRY } from '../oauth/oauth.module'; | ||
|
||
export const OAUTH_PROVIDERS = [...OAUTH_REGISTRY.keys()] as const; | ||
export const OAUTH_PROVIDERS = ['google', 'kakao', 'naver'] as const; | ||
|
||
export type OauthProvider = (typeof OAUTH_PROVIDERS)[number]; |