Skip to content

Conversation

@anzmin
Copy link
Member

@anzmin anzmin commented Nov 17, 2022

관련 이슈

작업 내용

OAuth 인터페이스를 기반으로 한 OAuth 구현체 구현

  • Naver
  • Kakao

OAuth 테스트 코드 작성

@anzmin anzmin linked an issue Nov 17, 2022 that may be closed by this pull request
3 tasks
Copy link
Collaborator

@seyoung8239 seyoung8239 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

백앤드 하나도 모르는 물음표 살인마 등판했습니다.. 고생하셨습니다!

Comment on lines +82 to +87
"moduleNameMapper": {
"@config": "<rootDir>/config/index",
"@constant": "<rootDir>/constant/index",
"@types": "<rootDir>/types/index",
"^src/(.*)$": "<rootDir>/$1"
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

요건 어떤 역할 하는건가요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이게 nest 시작은 빌드된 형태로 시작돼서 ts에서 alias 설정을 하면 빌드도 alias대로 바뀌는데, jest는 ts 상태에서 바로 해버려서 ts alias로 된 @types 같은 것을 못 읽어서 해당 alias가 실제로 어떤 경로인지 jest에 mapping하는 겁니다.

Comment on lines +10 to 11
"build": "nest build && tsc-alias",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

빌드 환경을 따로 구축하기 위해서 tsx-alias를 지정해주는 건가요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

빌드 때 d.ts.파일에 alias도 동일하게 되는데 저걸 돌리면 alias도 원래 경로로 돌아옵니다

@@ -0,0 +1 @@
export type MockRepository<T = any> = Partial<Record<keyof T, jest.Mock>>;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

유틸리티 타입 굿입니다.

// OAUTH
export enum OAUTH_TYPE {
NAVER = 'naver',
GOOGLE = 'google',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

구글은 왜 빼셨나요ㅋㅋ

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"노션에 발생한 문제"에서 보시면 원인이 있는데 그게 구글 문제인 줄 알고 kakao로 바꿨다가 나중에 원인을 파악해서 그냥 kakao로 갑니다

// const user = await this.authService.socialStart({ type, authorizationCode });
const user = await this.authService.socialStart({ type, authorizationCode });
const accessToken = this.authService.createJwt({
payload: { nickname: 'user.nickname', email: 'user.email' },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

테스트한다고 문자열 처리된 부분 다시 변수로 만들어주시면 됩니다~

@punkryn punkryn merged commit eff528d into dev Nov 17, 2022
@seyoung8239 seyoung8239 deleted the 10-be-oauth-구현체-구현 branch November 21, 2022 08:09
@bh2980 bh2980 changed the title BE - oauth 구현체 구현 (kakao, naver) oauth 구현체 구현 (kakao, naver) Nov 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BE - OAuth 구현체 구현

4 participants