diff --git a/src/auth/services/auth.service.ts b/src/auth/services/auth.service.ts index 18d13f1..1e261e6 100644 --- a/src/auth/services/auth.service.ts +++ b/src/auth/services/auth.service.ts @@ -73,6 +73,12 @@ export class AuthService { throw new BadRequestException('USERS.EMAIL_ALREADY_SET'); } + const existingUser = await this.userService.findUser({ email }); + + if (existingUser) { + throw new BadRequestException('USERS.EMAIL_ALREADY_TAKEN'); + } + return this.userService.setEmail(userId, email); }