Repository navigation
#6624 - Search student by certificate number #6849
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
Changes from 3 commits
fe73d3f
584f0b9
4f49766
4bec3c1
47d4116
0b977fc
75f886f
aa83cbd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,6 +8,7 @@ import { | |
| IsEmail, | ||
| IsEnum, | ||
| IsNotEmpty, | ||
| IsNumberString, | ||
| IsOptional, | ||
| IsPositive, | ||
| Length, | ||
|
|
@@ -108,34 +109,70 @@ export class UpdateStudentAPIInDTO | |
| export class StudentSearchAPIInDTO { | ||
| @ValidateIf( | ||
| (input: StudentSearchAPIInDTO) => | ||
| !input.lastName && !input.appNumber && !input.sin && !input.email, | ||
| !input.lastName && | ||
| !input.appNumber && | ||
| !input.sin && | ||
| !input.email && | ||
| !input.documentNumber, | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @tiago-graf Thanks for the discussion related to this. Instead of this approach, I would suggest using a class level validator to validate |
||
| ) | ||
| @IsNotEmpty() | ||
| firstName: string; | ||
| @ValidateIf( | ||
| (input: StudentSearchAPIInDTO) => | ||
| !input.firstName && !input.appNumber && !input.sin && !input.email, | ||
| !input.firstName && | ||
| !input.appNumber && | ||
| !input.sin && | ||
| !input.email && | ||
| !input.documentNumber, | ||
| ) | ||
| @IsNotEmpty() | ||
| lastName: string; | ||
| @ValidateIf( | ||
| (input: StudentSearchAPIInDTO) => | ||
| !input.firstName && !input.lastName && !input.sin && !input.email, | ||
| !input.firstName && | ||
| !input.lastName && | ||
| !input.sin && | ||
| !input.email && | ||
| !input.documentNumber, | ||
| ) | ||
| @IsNotEmpty() | ||
| appNumber: string; | ||
| @ValidateIf( | ||
| (input: StudentSearchAPIInDTO) => | ||
| !input.firstName && !input.lastName && !input.appNumber && !input.email, | ||
| !input.firstName && | ||
| !input.lastName && | ||
| !input.appNumber && | ||
| !input.email && | ||
| !input.documentNumber, | ||
| ) | ||
| @IsNotEmpty() | ||
| sin: string; | ||
| @ValidateIf( | ||
| (input: StudentSearchAPIInDTO) => | ||
| !input.firstName && !input.lastName && !input.appNumber && !input.sin, | ||
| !input.firstName && | ||
| !input.lastName && | ||
| !input.appNumber && | ||
| !input.sin && | ||
| !input.documentNumber, | ||
| ) | ||
| @IsNotEmpty() | ||
| email: string; | ||
| /** | ||
| * Certificate (financial document) number. Limited to 9 digits to fit the integer DB column. | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From a DB perspective, it should validate up to a max int4 amount. |
||
| */ | ||
| @ValidateIf( | ||
| (input: StudentSearchAPIInDTO) => | ||
| !!input.documentNumber || | ||
| (!input.firstName && | ||
| !input.lastName && | ||
| !input.appNumber && | ||
| !input.sin && | ||
| !input.email), | ||
| ) | ||
| @IsNotEmpty() | ||
| @IsNumberString({ no_symbols: true }) | ||
| @MaxLength(9) | ||
| documentNumber: string; | ||
|
andrewsignori-aot marked this conversation as resolved.
Resolved
|
||
| } | ||
|
|
||
| export class SearchStudentAPIOutDTO { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.