-
Notifications
You must be signed in to change notification settings - Fork 2
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
[Feat] 유저 정보 조회 API 구현 #288
Conversation
🎨 스토리북 확인하기
|
apps/api/src/user/user.controller.ts
Outdated
@@ -1,12 +1,22 @@ | |||
import { Controller, Get, Patch } from '@nestjs/common'; | |||
import { Controller, Get, Param, Patch, UseGuards } from '@nestjs/common'; |
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.
p3
안쓰는 import만 제거하고 머지하시면될거같습니다!
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.
const user = await this.userRepository | ||
.createQueryBuilder('user') | ||
.leftJoin('user.ticles', 'ticles') | ||
.addSelect('ticles.title') | ||
.where('user.id = :userId', { userId: userId }) | ||
.getOne(); |
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.
Q:
TypeORM
의 find({relations})
와 동일한 결과 값을 반환할 것 같은데 queryBuilder를 사용하신 이유가 있을까요?
return { | ||
id: user.id, | ||
nickname: user.nickname, | ||
profileImageUrl: user.profileImageUrl, | ||
provider: user.provider, | ||
ticles: ticles.map((ticle) => ticle.title), | ||
}; |
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.
p5:
만약 QueryBuilder를 사용하는게 목적이라면 QueryBuilder를 통해 직접 조회하는 것도 좋을 것 같습니다! (학습 목적으로)
관련 이슈 번호
작업 내용
PR 포인트
백엔드 팀원들의 도움을 받아서 구현했습니다.
고민과 학습내용
스크린샷