mirror of
https://github.com/ershisan99/flashcards-api.git
synced 2025-12-17 12:33:22 +00:00
add error handling for db calls
This commit is contained in:
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user