Skip to content

Commit 8189af0

Browse files
swagger api doc
1 parent a15a7bc commit 8189af0

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/users/dto/create-user.dto.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ApiProperty, ApiPropertyOptional } from "@nestjs/swagger";
12
import {
23
IsNotEmpty,
34
IsNumberString,
@@ -6,11 +7,15 @@ import {
67
} from "class-validator";
78

89
export class CreateUserDto {
10+
@ApiProperty({ example: 'testname', description: 'username of the user' })
911
@IsNumberString()
1012
@IsNotEmpty()
1113
username: String;
14+
@ApiProperty({ example: 'Pradip', description: 'first of the user' })
1215
first_name: String;
16+
@ApiProperty({ example: 'Patil', description: 'lastname of the user' })
1317
last_name: String;
18+
@ApiProperty({ example: 'Pradipatil1@', description: 'Password length min 8,1 lowerscase and uppercase letter, 1 number ,1symbol' })
1419
@IsStrongPassword({
1520
minLength: 8,
1621
minLowercase: 1,
@@ -20,12 +25,17 @@ export class CreateUserDto {
2025
})
2126
password: String;
2227
password_reset_code?: String;
28+
@ApiProperty({ example: 'Patil@test.com', description: 'email of the user' })
2329
email: String;
30+
@ApiPropertyOptional({ example: 'SDD1333', description: 'email code of the user' })
2431
email_code?: String;
2532
@IsOptional()
33+
@ApiPropertyOptional({ example: '22221111', description: 'email code of the user' })
2634
activation_code?: string;
35+
@ApiProperty({ description: 'Date of creation' })
2736
@IsOptional()
2837
createdAt?: Date;
38+
@ApiProperty({ description: 'Date of updated' })
2939
@IsOptional()
3040
updatedAt?: Date;
3141
}

0 commit comments

Comments
 (0)