matcher/src/modules/ad/domain/dtos/create-ad.request.ts

160 lines
2.2 KiB
TypeScript
Raw Normal View History

import { AutoMap } from '@automapper/classes';
2023-04-26 10:10:22 +00:00
import {
ArrayMinSize,
IsArray,
IsBoolean,
2023-05-11 15:47:55 +00:00
IsDate,
2023-04-26 10:10:22 +00:00
IsEnum,
2023-05-11 15:47:55 +00:00
IsMilitaryTime,
2023-04-26 10:10:22 +00:00
IsNotEmpty,
IsNumber,
IsOptional,
IsString,
} from 'class-validator';
import { Frequency } from '../types/frequency.enum';
2023-04-28 13:53:57 +00:00
import { Coordinates } from '../../../geography/domain/entities/coordinates';
2023-05-11 15:47:55 +00:00
import { Type } from 'class-transformer';
export class CreateAdRequest {
@IsString()
@IsNotEmpty()
@AutoMap()
uuid: string;
2023-05-11 15:47:55 +00:00
@IsString()
@IsNotEmpty()
@AutoMap()
userUuid: string;
@IsBoolean()
@AutoMap()
driver: boolean;
@IsBoolean()
@AutoMap()
passenger: boolean;
2023-04-26 10:10:22 +00:00
@IsEnum(Frequency)
@AutoMap()
2023-04-26 10:10:22 +00:00
frequency: Frequency;
2023-05-11 15:47:55 +00:00
@Type(() => Date)
@IsDate()
@AutoMap()
2023-05-11 15:47:55 +00:00
fromDate: Date;
2023-05-11 15:47:55 +00:00
@Type(() => Date)
@IsDate()
@AutoMap()
2023-05-11 15:47:55 +00:00
toDate: Date;
2023-04-26 10:10:22 +00:00
@IsOptional()
2023-05-11 15:47:55 +00:00
@IsMilitaryTime()
@AutoMap()
2023-05-11 15:47:55 +00:00
monTime?: string;
2023-04-26 10:10:22 +00:00
@IsOptional()
2023-05-11 15:47:55 +00:00
@IsMilitaryTime()
@AutoMap()
2023-05-11 15:47:55 +00:00
tueTime?: string;
2023-04-26 10:10:22 +00:00
@IsOptional()
2023-05-11 15:47:55 +00:00
@IsMilitaryTime()
@AutoMap()
2023-05-11 15:47:55 +00:00
wedTime?: string;
2023-04-26 10:10:22 +00:00
@IsOptional()
2023-05-11 15:47:55 +00:00
@IsMilitaryTime()
@AutoMap()
2023-05-11 15:47:55 +00:00
thuTime?: string;
2023-04-26 10:10:22 +00:00
@IsOptional()
2023-05-11 15:47:55 +00:00
@IsMilitaryTime()
@AutoMap()
2023-05-11 15:47:55 +00:00
friTime?: string;
2023-04-26 10:10:22 +00:00
@IsOptional()
2023-05-11 15:47:55 +00:00
@IsMilitaryTime()
@AutoMap()
2023-05-11 15:47:55 +00:00
satTime?: string;
2023-04-26 10:10:22 +00:00
@IsOptional()
2023-05-11 15:47:55 +00:00
@IsMilitaryTime()
@AutoMap()
2023-05-11 15:47:55 +00:00
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;
2023-05-11 15:47:55 +00:00
@Type(() => Coordinates)
2023-04-26 10:10:22 +00:00
@IsArray()
@ArrayMinSize(2)
2023-04-26 12:14:46 +00:00
@AutoMap(() => [Coordinates])
waypoints: Coordinates[];
2023-05-11 15:47:55 +00:00
@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;
2023-04-26 10:10:22 +00:00
@IsOptional()
@IsNumber()
@AutoMap()
2023-05-02 15:26:04 +00:00
seatsUsed?: number;
2023-05-11 15:47:55 +00:00
@IsBoolean()
@AutoMap()
2023-05-11 15:47:55 +00:00
strict: boolean;
2023-04-28 13:53:57 +00:00
2023-05-02 15:26:04 +00:00
timezone?: string;
}