-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move validations done in the user controllers into DTO #459
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check all the validations and solve the conflicts
if (userRegistrationData.orgName.trim() === '') { | ||
throw new ConflictException({ | ||
success: false, | ||
message: `orgName should not be empty`, | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This validation is not done because if I send an empty string with space inside it I don't get any error and the response becomes successful.
example:
{ "firstName": "babous", "lastName": "cedrus", "email": "babouce@gmail.com", "organizationType": "Buyer", "password": "King@123", "confirmPassword": "King@123", "orgName": " ", "orgAddress": "KN150" }
if ( | ||
userRegistrationData.organizationType.toLowerCase() != | ||
'Buyer'.toLowerCase() && | ||
userRegistrationData.organizationType.toLowerCase() != | ||
'Developer'.toLowerCase() && | ||
userRegistrationData.organizationType.toLowerCase() != | ||
'ApiUser'.toLowerCase() | ||
) { | ||
throw new ConflictException({ | ||
success: false, | ||
message: `organizationType value should be Developer/Buyer/ApiUser`, | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This validation is not implemented because when I send an organizationType with buyer
I get a forbidden error.
Example
{ "firstName": "babous", "lastName": "cedrus", "email": "babouce@gmail.com", "organizationType": "buyer", "password": "King@123", "confirmPassword": "King@123", "orgName": "BC group", "orgAddress": "KN150" }
response
{ "statusCode": 403, "message": "Forbidden resource", "error": "Forbidden" }
'Developer'.toLowerCase() && | ||
userRegistrationData.organizationType.toLowerCase() != | ||
'ApiUser'.toLowerCase() | ||
) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here you have removed the validation to check if the organization type matches certain values and this validation wasn't added to the DTO
Move validations done in the user controllers into DTO
Update user controller and move the validation logic to the DTO
Issue ticket #456 and link
Checklist before requesting a review