Skip to content

Commit

Permalink
Merge pull request #138 from boostcampwm2023/feat/129-signup-api-resp…
Browse files Browse the repository at this point in the history
…onse-handling

[Hotfix] Conflict Exception 오류 수정
  • Loading branch information
JoonSoo-Kim authored Nov 23, 2023
2 parents 118fe04 + d002a37 commit 1a8f045
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions BE/src/auth/users.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,17 @@ export class UsersRepository {

const salt = await bcrypt.genSalt();
const hashedPassword = await bcrypt.hash(password, salt);

const userIdDuplicate = await User.findOne({ where: { userId: userId } });
if (userIdDuplicate) {
throw new ConflictException("중복된 아이디입니다.");
}

const emailDuplicate = await User.findOne({ where: { email: email } });
if (emailDuplicate) {
throw new ConflictException("중복된 이메일입니다.");
}

const user = User.create({
userId,
password: hashedPassword,
Expand Down

0 comments on commit 1a8f045

Please sign in to comment.