75 lines
1.7 KiB
TypeScript
75 lines
1.7 KiB
TypeScript
import { ApiProperty } from '@nestjs/swagger';
|
|
import {
|
|
IsString,
|
|
IsNumber,
|
|
IsOptional,
|
|
IsArray,
|
|
ValidateNested,
|
|
IsUUID,
|
|
Min,
|
|
IsDateString,
|
|
} from 'class-validator';
|
|
import { Type } from 'class-transformer';
|
|
|
|
export class SupplierOrderItemDto {
|
|
@ApiProperty({ description: 'ID del producto del proveedor' })
|
|
@IsUUID()
|
|
productId: string;
|
|
|
|
@ApiProperty({ example: 10, description: 'Cantidad a ordenar' })
|
|
@IsNumber()
|
|
@Min(1)
|
|
quantity: number;
|
|
|
|
@ApiProperty({ description: 'Notas para este item', required: false })
|
|
@IsString()
|
|
@IsOptional()
|
|
notes?: string;
|
|
}
|
|
|
|
export class CreateSupplierOrderDto {
|
|
@ApiProperty({ description: 'ID del proveedor' })
|
|
@IsUUID()
|
|
supplierId: string;
|
|
|
|
@ApiProperty({ type: [SupplierOrderItemDto], description: 'Items del pedido' })
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => SupplierOrderItemDto)
|
|
items: SupplierOrderItemDto[];
|
|
|
|
@ApiProperty({ description: 'Direccion de entrega' })
|
|
@IsString()
|
|
deliveryAddress: string;
|
|
|
|
@ApiProperty({ description: 'Ciudad', required: false })
|
|
@IsString()
|
|
@IsOptional()
|
|
deliveryCity?: string;
|
|
|
|
@ApiProperty({ description: 'Codigo postal', required: false })
|
|
@IsString()
|
|
@IsOptional()
|
|
deliveryZip?: string;
|
|
|
|
@ApiProperty({ description: 'Telefono de contacto', required: false })
|
|
@IsString()
|
|
@IsOptional()
|
|
deliveryPhone?: string;
|
|
|
|
@ApiProperty({ description: 'Nombre de contacto', required: false })
|
|
@IsString()
|
|
@IsOptional()
|
|
deliveryContact?: string;
|
|
|
|
@ApiProperty({ description: 'Fecha solicitada de entrega (YYYY-MM-DD)', required: false })
|
|
@IsDateString()
|
|
@IsOptional()
|
|
requestedDate?: string;
|
|
|
|
@ApiProperty({ description: 'Notas adicionales', required: false })
|
|
@IsString()
|
|
@IsOptional()
|
|
notes?: string;
|
|
}
|