Skip to content

Commit

Permalink
chore(be): signup-for-load-test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaehyeon1020 committed May 10, 2024
1 parent 99d5383 commit af01a5e
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions apps/backend/apps/client/src/user/user.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,31 @@ export class UserService {
email: signUpDto.email + randomUUID()
}

const duplicatedUser = await this.prisma.user.findUnique({
where: {
username: newSignUpDto.username
}
})
if (duplicatedUser) {
this.logger.debug('username duplicated')
throw new DuplicateFoundException('Username')
}

if (!this.isValidUsername(signUpDto.username)) {
this.logger.debug('signUp - fail (invalid username)')
throw new UnprocessableDataException('Bad username')
} else if (!this.isValidPassword(signUpDto.password)) {
this.logger.debug('signUp - fail (invalid password)')
throw new UnprocessableDataException('Bad password')
}
try {
await this.deletePinFromCache(
emailAuthenticationPinCacheKey(newSignUpDto.email)
)
} catch (e) {
// pass
}

const user: User = await this.createUser(newSignUpDto)
const CreateUserProfileData: CreateUserProfileData = {
userId: user.id,
Expand Down

0 comments on commit af01a5e

Please sign in to comment.