create-user.dto.ts
nest.js/02-intermediate/code/users/dto/create-user.dto.ts
import {
IsString,
IsEmail,
IsOptional,
IsInt,
Min,
Max,
MinLength,
MaxLength,
} from 'class-validator';
export class CreateUserDto {
@IsString()
@MinLength(3)
@MaxLength(50)
name: string;
@IsEmail()
email: string;
@IsOptional()
@IsInt()
@Min(18)
@Max(100)
age?: number;
}
Articoli correlati
app.controller.ts
app.controller.ts — typescript source code from the nest.js learning materials (nest.js/01-beginner/code/app.controller.ts).
Leggi l'articolo →app.module.ts
app.module.ts — typescript source code from the nest.js learning materials (nest.js/01-beginner/code/app.module.ts).
Leggi l'articolo →app.service.ts
app.service.ts — typescript source code from the nest.js learning materials (nest.js/01-beginner/code/app.service.ts).
Leggi l'articolo →main.ts
main.ts — typescript source code from the nest.js learning materials (nest.js/01-beginner/code/main.ts).
Leggi l'articolo →todos.controller.ts
todos.controller.ts — typescript source code from the nest.js learning materials (nest.js/01-beginner/code/todos/todos.controller.ts).
Leggi l'articolo →todos.module.ts
todos.module.ts — typescript source code from the nest.js learning materials (nest.js/01-beginner/code/todos/todos.module.ts).
Leggi l'articolo →