import { AutoMap } from '@automapper/classes'; import { ArrayMinSize, IsArray, IsBoolean, IsEnum, IsNotEmpty, IsNumber, IsOptional, IsString, } from 'class-validator'; import { PointType } from '../../../geography/domain/types/point-type.enum'; import { Frequency } from '../types/frequency.enum'; import { Coordinates } from '../../../geography/domain/entities/coordinates'; export class CreateAdRequest { @IsString() @IsNotEmpty() @AutoMap() uuid: string; @IsBoolean() @AutoMap() driver: boolean; @IsBoolean() @AutoMap() passenger: boolean; @IsNotEmpty() @IsEnum(Frequency) @AutoMap() frequency: Frequency; @IsString() @AutoMap() fromDate: string; @IsString() @AutoMap() toDate: string; @IsOptional() @IsString() @AutoMap() monTime?: string | null; @IsOptional() @IsString() @AutoMap() tueTime?: string | null; @IsOptional() @IsString() @AutoMap() wedTime?: string | null; @IsOptional() @IsString() @AutoMap() thuTime?: string | null; @IsOptional() @IsString() @AutoMap() friTime?: string | null; @IsOptional() @IsString() @AutoMap() satTime?: string | null; @IsOptional() @IsString() @AutoMap() sunTime?: string | null; @IsNumber() @AutoMap() monMargin: number; @IsNumber() @AutoMap() tueMargin: number; @IsNumber() @AutoMap() wedMargin: number; @IsNumber() @AutoMap() thuMargin: number; @IsNumber() @AutoMap() friMargin: number; @IsNumber() @AutoMap() satMargin: number; @IsNumber() @AutoMap() sunMargin: number; @IsEnum(PointType) @AutoMap() originType: PointType; @IsEnum(PointType) @AutoMap() destinationType: PointType; @IsArray() @ArrayMinSize(2) @AutoMap(() => [Coordinates]) waypoints: Coordinates[]; @IsNumber() @AutoMap() seatsDriver: number; @IsNumber() @AutoMap() seatsPassenger: number; @IsOptional() @IsNumber() @AutoMap() seatsUsed?: number; @IsString() @AutoMap() createdAt: string; @IsString() @AutoMap() updatedAt: string; timezone?: string; }