Skip to content

Commit

Permalink
verify email
Browse files Browse the repository at this point in the history
  • Loading branch information
Janderson Souza Matias authored and Janderson Souza Matias committed Jun 26, 2024
1 parent ba28a17 commit fc0ced5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/modules/coach/service/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@ export class CoachService {
throw Error("Email is required");
}

if (await userRepository.exist({ where: { email: data.email } })) {
if (
await userRepository.exist({
where: { email: data.email.toLocaleLowerCase().trim() },
})
) {
throw Error("Exists a coach with this email");
}

return userRepository.save(data);
return userRepository.save({
...data,
email: data.email.toLocaleLowerCase().trim(),
});
};

static update = async (
Expand Down

0 comments on commit fc0ced5

Please sign in to comment.