interfaces
export interface RegisterInterface {
readonly username: string;
readonly password: string;
readonly firstName?: string;
readonly lastName?: string;
readonly fullName?: string;
}
dto
import { IsString, IsInt } from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';
export class CreateCatDto {
@ApiProperty({
example: 'fuguoqiang',
description: 'The age of the Cat',
})
@IsString()
readonly name: string;
@ApiProperty({ example: 28, description: 'The age of the Cat' })
@IsInt()
readonly age: number;
@ApiProperty({ example: '猫', description: 'The age of the Cat' })
@IsString()
readonly breed: string;
}
classes
import { ApiProperty } from '@nestjs/swagger';
export class RegisterClasses {
@ApiProperty({ example: 'MaineMaine', description: 'The age of the Cat' })
username: string;
@ApiProperty({
example: 'Maine',
description: 'The breed of the Cat',
})
password: string;
@ApiProperty({
example: 'Maine',
description: 'The breed of the Cat',
})
firstName?: string;
@ApiProperty({
example: 'Coon',
description: 'The breed of the Cat',
})
lastName?: string;
@ApiProperty({
example: 'Maine Coon',
description: 'The breed of the Cat',
})
fullName?: string;
}