-
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.
* [backend] `yarn add class-transformer class-validator` * [backend] Add validation to the user creation endpoint * [backend] Add ParseIntPipe to user controller
- Loading branch information
Showing
5 changed files
with
68 additions
and
6 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
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 |
---|---|---|
@@ -1,12 +1,39 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger'; | ||
import { | ||
IsEmail, | ||
IsNotEmpty, | ||
IsString, | ||
IsOptional, | ||
MinLength, | ||
MaxLength, | ||
} from 'class-validator'; | ||
|
||
export class CreateUserDto { | ||
@ApiProperty() | ||
@IsEmail() | ||
@IsNotEmpty() | ||
@IsString() | ||
@MaxLength(255) | ||
@ApiProperty({ | ||
type: String, | ||
description: 'Email of the user', | ||
format: 'email', | ||
}) | ||
email: string; | ||
|
||
@ApiProperty({ required: false }) | ||
@IsString() | ||
@IsOptional() | ||
@MaxLength(255) | ||
@MinLength(3) | ||
@ApiPropertyOptional({ | ||
type: String, | ||
description: 'Name of the user', | ||
}) | ||
name?: string; | ||
|
||
@IsString() | ||
@IsNotEmpty() | ||
@MinLength(6) | ||
@MaxLength(255) | ||
@ApiProperty() | ||
password: string; | ||
} |
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