-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(password-reset): implementing execute method at the controller
- Loading branch information
1 parent
194c917
commit 9a09f17
Showing
8 changed files
with
246 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"validations": { | ||
"OLD_PASSWORD_IS_DEFINED": "Your old password must be defined.", | ||
"OLD_PASSWORD_IS_STRING": "Your old password must be a valid text.", | ||
"OLD_PASSWORD_IS_NOT_EMPTY": "Your old password must be valid.", | ||
"NEW_PASSWORD_IS_DEFINED": "Your new password must be defined.", | ||
"NEW_PASSWORD_IS_STRING": "Your new password must be a valid text.", | ||
"NEW_PASSWORD_IS_NOT_EMPTY": "Your new password must be valid." | ||
}, | ||
"errors": { | ||
"password-reset-not-found": "Your password reset request was not found.", | ||
"incorrect-old-password": "Your old password must match the current password.", | ||
"user-not-found": "The user was not found." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"validations": { | ||
"OLD_PASSWORD_IS_DEFINED": "A antiga senha do usuário deve ser definido.", | ||
"OLD_PASSWORD_IS_STRING": "A antiga senha do usuário deve ser um texto válido.", | ||
"OLD_PASSWORD_IS_NOT_EMPTY": "A antiga senha do usuário não pode estar vazia.", | ||
"NEW_PASSWORD_IS_DEFINED": "A nova senha do usuário deve ser definido.", | ||
"NEW_PASSWORD_IS_STRING": "A nova senha do usuário deve ser um texto válido.", | ||
"NEW_PASSWORD_IS_NOT_EMPTY": "A nova senha do usuário não pode estar vazia." | ||
}, | ||
"errors": { | ||
"password-reset-not-found": "A solicitação de alteração de senha não foi encontrada.", | ||
"incorrect-old-password": "A senha atual não coincidiu com o registro.", | ||
"user-not-found": "O usuário não foi encontrado." | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/modules/password-reset/domain/usecases/execute/execute-password-reset.usecase.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/modules/password-reset/presenter/models/payloads/execute-password-reset.payload.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IsDefined, IsString, IsNotEmpty } from 'class-validator'; | ||
import { i18nValidationMessage } from 'nestjs-i18n'; | ||
import { I18nTranslations } from 'src/generated/i18n.generated'; | ||
|
||
export class ExecutePasswordResetPayload { | ||
@ApiProperty({ example: 'J0hn.Doe@123' }) | ||
@IsDefined({ | ||
message: i18nValidationMessage<I18nTranslations>( | ||
'user.validations.PASSWORD_IS_DEFINED', | ||
), | ||
}) | ||
@IsString({ | ||
message: i18nValidationMessage<I18nTranslations>( | ||
'user.validations.PASSWORD_IS_STRING', | ||
), | ||
}) | ||
@IsNotEmpty({ | ||
message: i18nValidationMessage<I18nTranslations>( | ||
'user.validations.PASSWORD_IS_NOT_EMPTY', | ||
), | ||
}) | ||
oldPassword: string; | ||
|
||
@ApiProperty({ example: 'J0hn.Doe@123' }) | ||
@IsDefined({ | ||
message: i18nValidationMessage<I18nTranslations>( | ||
'user.validations.PASSWORD_IS_DEFINED', | ||
), | ||
}) | ||
@IsString({ | ||
message: i18nValidationMessage<I18nTranslations>( | ||
'user.validations.PASSWORD_IS_STRING', | ||
), | ||
}) | ||
@IsNotEmpty({ | ||
message: i18nValidationMessage<I18nTranslations>( | ||
'user.validations.PASSWORD_IS_NOT_EMPTY', | ||
), | ||
}) | ||
newPassword: string; | ||
} |