-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BE] 2.04 oAuth를 활용한 로그인 API 구현 #7 #43
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생 많으셨습니다~
라고하려햇는데 린트 오류나네요...
constructor( | ||
private authService: AuthService, | ||
private configService: ConfigService, | ||
) {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 요런 아이들 private readonly로 통일하는게 좋지 않을까용??
BE/src/auth/auth.service.ts
Outdated
const currentRefreshToken = await bcrypt.hash(refreshToken, salt); | ||
const currentRefreshTokenExpiresAt = new Date( | ||
currentDate.getTime() + | ||
parseInt(this.configService.get<string>('JWT_REFRESH_EXPIRATION_TIME')), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 헉 진명님도 process.env 안되셔서 이렇게 하신건가요??
BE/src/app.module.ts
Outdated
@@ -23,7 +22,7 @@ import { KoreaInvestmentModule } from './koreaInvestment/korea.investment.module | |||
username: process.env.DB_USERNAME, | |||
password: process.env.DB_PASSWD, | |||
database: process.env.DB_DATABASE, | |||
entities: [User], | |||
entities: [__dirname + '/../**/*.entity.{js,ts}'], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 이렇게 추가하면 일일이 추가하지 않아도 되겠네요! 좋습니다.
entities: [__dirname + '/../**/*.entity.{js,ts}'], | ||
synchronize: true, | ||
}), | ||
TypeOrmModule.forRoot(typeOrmConfig), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟢 코드를 정리하니 보기 좋네요~
이거 근데 저만 풀리퀘스트 이름 잘못 보이나요? 바로 밑에 시은님 풀리퀘 이름이랑 똑같이 보이네요 |
✅ 주요 작업
💭 고민과 해결과정
express 모듈의 Request 타입 재정의
express Request에는 user 필드가 없기 때문에 req.user 로 접근이 불가능 하였다.
nestjs에서 여러 모듈의 타입들을 상속받아 재정의 할 수 있다는 것을 알게 되어 적용해보았다.
해당 파일을 생성 후에
tsconfig.json 의 compilerOptions 에
"typeRoots": ["./node_modules/@types", "./src/types"]
추가하여 type 을 재정의 할 수 있었다.