targo-backend/src/modules/customers/dtos/create-customer.dto.ts
2025-07-22 15:56:01 -04:00

64 lines
1.3 KiB
TypeScript

import { ApiProperty } from "@nestjs/swagger";
import { Type } from "class-transformer";
import {
IsEmail,
IsInt,
IsNotEmpty,
IsOptional,
IsPositive,
IsString,
} from "class-validator";
export class CreateCustomerDto {
@ApiProperty({
example: 'Gandalf',
description: 'Customer`s first name',
})
@IsString()
@IsNotEmpty()
first_name: string;
@ApiProperty({
example: 'TheGray',
description: 'Customer`s last name',
})
@IsString()
@IsNotEmpty()
last_name: string;
@ApiProperty({
example: 'you_shall_not_pass@middleEarth.com',
description: 'Customer`s email',
})
@IsEmail()
@IsOptional()
email: string;
@ApiProperty({
example: '8436637464',
description: 'Customer`s phone number',
})
@Type(() => Number)
@IsInt()
@IsPositive()
phone_number: number;
@ApiProperty({
example: '1 Ringbearer`s way, Mount Doom city, ME, T1R 1N6 ',
description: 'Customer`s residence',
required: false,
})
@IsString()
@IsOptional()
residence?: string;
@ApiProperty({
example: '4263253',
description: 'Customer`s invoice number',
required: false,
})
@IsInt()
@IsNotEmpty()
invoice_id: number;
}