-
Notifications
You must be signed in to change notification settings - Fork 0
2023 03 30 개발 일지
Jinho Kim edited this page Mar 29, 2023
·
14 revisions
- repository에 createQueryBuilder가 들어있어서 아래와 같은 방식으로 쉽게 확인할 수 있었다.
const userId = createUserDto.userId;
const existUser = await this.userRepository
.createQueryBuilder('user')
.where('user.userId = :userId', { userId })
.select(['user.userId'])
.getOne();
console.log(existUser);
if (existUser) {
throw new HttpException('User id already exists', HttpStatus.BAD_REQUEST);
}