add error handling for db calls

This commit is contained in:
andres
2023-06-16 12:01:14 +02:00
parent 121fceb97a
commit 9cd6595ae2
11 changed files with 590 additions and 114 deletions

View File

@@ -4,6 +4,7 @@ import {
Get,
HttpCode,
HttpStatus,
Param,
Post,
Request,
Res,
@@ -24,6 +25,8 @@ import {
LogoutCommand,
RefreshTokenCommand,
ResendVerificationEmailCommand,
ResetPasswordCommand,
SendPasswordRecoveryEmailCommand,
VerifyEmailCommand,
} from './use-cases'
@@ -97,4 +100,14 @@ export class AuthController {
accessToken: newTokens.accessToken,
}
}
@Post('recover-password')
async recoverPassword(@Body('email') email: string) {
return await this.commandBus.execute(new SendPasswordRecoveryEmailCommand(email))
}
@Post('reset-password/:token')
async resetPassword(@Body('password') password: string, @Param('token') token: string) {
return await this.commandBus.execute(new ResetPasswordCommand(token, password))
}
}