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

140 lines
2.0 KiB
TypeScript
Raw Normal View History

import { AutoMap } from '@automapper/classes';
2023-04-26 10:10:22 +00:00
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';
2023-04-26 12:14:46 +00:00
import { Coordinates } from '../../../geography/domain/types/coordinates.type';
export class CreateAdRequest {
@IsString()
@IsNotEmpty()
@AutoMap()
uuid: string;
@IsBoolean()
@AutoMap()
driver: boolean;
@IsBoolean()
@AutoMap()
passenger: boolean;
2023-04-26 10:10:22 +00:00
@IsNotEmpty()
@IsEnum(Frequency)
@AutoMap()
2023-04-26 10:10:22 +00:00
frequency: Frequency;
@IsString()
@AutoMap()
fromDate: string;
@IsString()
@AutoMap()
toDate: string;
2023-04-26 10:10:22 +00:00
@IsOptional()
@IsString()
@AutoMap()
2023-04-26 10:10:22 +00:00
monTime: string | null;
2023-04-26 10:10:22 +00:00
@IsOptional()
@IsString()
@AutoMap()
2023-04-26 10:10:22 +00:00
tueTime: string | null;
2023-04-26 10:10:22 +00:00
@IsOptional()
@IsString()
@AutoMap()
2023-04-26 10:10:22 +00:00
wedTime: string | null;
2023-04-26 10:10:22 +00:00
@IsOptional()
@IsString()
@AutoMap()
2023-04-26 10:10:22 +00:00
thuTime!: string | null;
2023-04-26 10:10:22 +00:00
@IsOptional()
@IsString()
@AutoMap()
2023-04-26 10:10:22 +00:00
friTime: string | null;
2023-04-26 10:10:22 +00:00
@IsOptional()
@IsString()
@AutoMap()
2023-04-26 10:10:22 +00:00
satTime: string | null;
2023-04-26 10:10:22 +00:00
@IsOptional()
@IsString()
@AutoMap()
2023-04-26 10:10:22 +00:00
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;
2023-04-26 10:10:22 +00:00
@IsEnum(PointType)
@AutoMap()
2023-04-26 10:10:22 +00:00
originType: PointType;
2023-04-26 10:10:22 +00:00
@IsEnum(PointType)
@AutoMap()
2023-04-26 10:10:22 +00:00
destinationType: PointType;
2023-04-26 10:10:22 +00:00
@IsArray()
@ArrayMinSize(2)
2023-04-26 12:14:46 +00:00
@AutoMap(() => [Coordinates])
waypoints: Coordinates[];
@IsNumber()
@AutoMap()
seatsDriver: number;
@IsNumber()
@AutoMap()
seatsPassenger: number;
2023-04-26 10:10:22 +00:00
@IsOptional()
@IsNumber()
@AutoMap()
seatsUsed: number;
@IsString()
@AutoMap()
createdAt: string;
@IsString()
@AutoMap()
updatedAt: string;
}