src/trips/dto/create-trip.dto.ts
Properties |
|
| Optional driverId |
Type : string
|
Decorators :
@ApiPropertyOptional({description: 'Driver assigned to the trip — can be assigned later.'})
|
|
Defined in src/trips/dto/create-trip.dto.ts:88
|
| Optional endDate |
Type : string
|
Decorators :
@ApiPropertyOptional()
|
|
Defined in src/trips/dto/create-trip.dto.ts:98
|
| Optional laneId |
Type : string
|
Decorators :
@ApiPropertyOptional()
|
|
Defined in src/trips/dto/create-trip.dto.ts:131
|
| Optional loadingBayId |
Type : string
|
Decorators :
@ApiPropertyOptional()
|
|
Defined in src/trips/dto/create-trip.dto.ts:126
|
| Optional notes |
Type : string
|
Decorators :
@ApiPropertyOptional()
|
|
Defined in src/trips/dto/create-trip.dto.ts:103
|
| Optional orderIds |
Type : string[]
|
Decorators :
@ApiPropertyOptional({type: undefined})
|
|
Defined in src/trips/dto/create-trip.dto.ts:121
|
| Optional podRequired |
Type : boolean
|
Decorators :
@ApiPropertyOptional({description: 'Require proof of delivery (photo + signature) before trip can be completed'})
|
|
Defined in src/trips/dto/create-trip.dto.ts:108
|
| Optional startDate |
Type : string
|
Decorators :
@ApiPropertyOptional()
|
|
Defined in src/trips/dto/create-trip.dto.ts:93
|
| Optional stops |
Type : CreateTripStopDto[]
|
Decorators :
@ApiPropertyOptional({type: undefined})
|
|
Defined in src/trips/dto/create-trip.dto.ts:115
|
| vehicleId |
Type : string
|
Decorators :
@ApiProperty({description: 'Vehicle assigned to the trip — required.'})
|
|
Defined in src/trips/dto/create-trip.dto.ts:83
|
import {
IsNotEmpty,
IsString,
IsOptional,
IsDateString,
IsArray,
IsBoolean,
ValidateNested,
IsNumber,
IsInt,
} from 'class-validator';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { Type } from 'class-transformer';
export class CreateTripStopDto {
@ApiProperty()
@IsInt()
sequence: number;
@ApiProperty({ example: 'PICKUP' })
@IsString()
@IsNotEmpty()
stopType: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
name?: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
address?: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
city?: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
state?: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
zipCode?: string;
@ApiPropertyOptional()
@IsOptional()
@IsNumber()
lat?: number;
@ApiPropertyOptional()
@IsOptional()
@IsNumber()
lng?: number;
@ApiPropertyOptional()
@IsOptional()
@IsDateString()
plannedArrival?: string;
@ApiPropertyOptional()
@IsOptional()
@IsDateString()
plannedDeparture?: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
notes?: string;
}
export class CreateTripDto {
// A trip without a vehicle or driver is meaningless — there's nothing
// to dispatch and the dispatch Gantt has nothing to render. Make
// both required at the DTO layer so this never gets through.
@ApiProperty({ description: 'Vehicle assigned to the trip — required.' })
@IsString()
@IsNotEmpty({ message: 'A trip must have a vehicle assigned.' })
vehicleId!: string;
@ApiPropertyOptional({ description: 'Driver assigned to the trip — can be assigned later.' })
@IsOptional()
@IsString()
driverId?: string;
@ApiPropertyOptional()
@IsOptional()
@IsDateString()
startDate?: string;
@ApiPropertyOptional()
@IsOptional()
@IsDateString()
endDate?: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
notes?: string;
@ApiPropertyOptional({ description: 'Require proof of delivery (photo + signature) before trip can be completed' })
@IsOptional()
@IsBoolean()
podRequired?: boolean;
@ApiPropertyOptional({ type: [CreateTripStopDto] })
@IsOptional()
@IsArray()
@ValidateNested({ each: true })
@Type(() => CreateTripStopDto)
stops?: CreateTripStopDto[];
@ApiPropertyOptional({ type: [String] })
@IsOptional()
@IsArray()
@IsString({ each: true })
orderIds?: string[];
@ApiPropertyOptional()
@IsOptional()
@IsString()
loadingBayId?: string;
@ApiPropertyOptional()
@IsOptional()
@IsString()
laneId?: string;
}