Skip to content

Commit

Permalink
✨ Feat: 이메일 존재 여부 확인 api
Browse files Browse the repository at this point in the history
#
  • Loading branch information
ks1ksi committed Aug 31, 2023
1 parent 56d909e commit 60ebe9e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/auth/auth.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,10 @@ export class AuthController {
verifySignupCode(@Body() verifyCodeDto: VerifyCodeDto): Promise<void> {
return this.authService.verifySignupCode(verifyCodeDto);
}

@Post('/check-email')
@HttpCode(HttpStatus.OK)
checkEmail(@Body() emailDto: EmailDto): Promise<void> {
return this.authService.checkEmail(emailDto);
}
}
12 changes: 12 additions & 0 deletions src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,18 @@ export class AuthService {
});
}

async checkEmail(emailDto: EmailDto) {
const { email } = emailDto;

const userEmail = await this.prisma.user.findUnique({
where: { email },
});

if (!userEmail) {
throw new ForbiddenException('No such email');
}
}

async getToken(user: User): Promise<Token> {
const accessToken = await this.jwtService.signAsync(
{
Expand Down

0 comments on commit 60ebe9e

Please sign in to comment.