import { AutoMap } from '@automapper/classes'; import { ArrayMinSize, IsArray, IsBoolean, IsDate, IsEnum, IsMilitaryTime, IsNotEmpty, IsNumber, IsOptional, IsString, } from 'class-validator'; import { Frequency } from '../types/frequency.enum'; import { Coordinates } from '../../../geography/domain/entities/coordinates'; import { Type } from 'class-transformer'; export class CreateAdRequest { @IsString() @IsNotEmpty() @AutoMap() uuid: string; @IsString() @IsNotEmpty() @AutoMap() userUuid: string; @IsBoolean() @AutoMap() driver: boolean; @IsBoolean() @AutoMap() passenger: boolean; @IsEnum(Frequency) @AutoMap() frequency: Frequency; @Type(() => Date) @IsDate() @AutoMap() fromDate: Date; @Type(() => Date) @IsDate() @AutoMap() toDate: Date; @IsOptional() @IsMilitaryTime() @AutoMap() monTime?: string; @IsOptional() @IsMilitaryTime() @AutoMap() tueTime?: string; @IsOptional() @IsMilitaryTime() @AutoMap() wedTime?: string; @IsOptional() @IsMilitaryTime() @AutoMap() thuTime?: string; @IsOptional() @IsMilitaryTime() @AutoMap() friTime?: string; @IsOptional() @IsMilitaryTime() @AutoMap() satTime?: string; @IsOptional() @IsMilitaryTime() @AutoMap() sunTime?: string; @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; @Type(() => Coordinates) @IsArray() @ArrayMinSize(2) @AutoMap(() => [Coordinates]) waypoints: Coordinates[]; @AutoMap() driverDuration?: number; @AutoMap() driverDistance?: number; @AutoMap() passengerDuration?: number; @AutoMap() passengerDistance?: number; @AutoMap() direction: string; @AutoMap() fwdAzimuth: number; @AutoMap() backAzimuth: number; @IsNumber() @AutoMap() seatsDriver: number; @IsNumber() @AutoMap() seatsPassenger: number; @IsOptional() @IsNumber() @AutoMap() seatsUsed?: number; @IsBoolean() @AutoMap() strict: boolean; timezone?: string; }