mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
95 lines
2.1 KiB
TypeScript
95 lines
2.1 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { Type } from 'class-transformer';
|
|
import {
|
|
ArrayMinSize,
|
|
IsArray,
|
|
IsBoolean,
|
|
IsInt,
|
|
IsNumber,
|
|
IsOptional,
|
|
IsString,
|
|
IsUUID,
|
|
Min,
|
|
ValidateNested,
|
|
} from 'class-validator';
|
|
|
|
export class ContainerPlacementDto {
|
|
@ApiProperty({ format: 'uuid' })
|
|
@IsUUID()
|
|
bookingContainerId!: string;
|
|
|
|
@ApiProperty({ minimum: 0 })
|
|
@IsInt()
|
|
@Min(0)
|
|
unitIndex!: number;
|
|
|
|
@ApiProperty({ minimum: 1 })
|
|
@IsInt()
|
|
@Min(1)
|
|
sequenceNo!: number;
|
|
|
|
@ApiPropertyOptional({ format: 'uuid' })
|
|
@IsOptional()
|
|
@IsUUID()
|
|
containerId?: string;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
containerNumber?: string;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
sealNumber?: string;
|
|
}
|
|
|
|
export class AssignBookingsDto {
|
|
@ApiProperty({ type: [String] })
|
|
@IsArray()
|
|
@ArrayMinSize(1)
|
|
@IsUUID('4', { each: true })
|
|
bookingIds!: string[];
|
|
|
|
@ApiPropertyOptional({ description: 'Suppress soft hold and overweight warnings' })
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
forceAssign?: boolean;
|
|
|
|
@ApiPropertyOptional({
|
|
description:
|
|
'Linked bookings the plan cannot seat stay linked as WAITING_FOR_WAGON instead of failing the whole allocation (auto-allocation mode). Requested bookingIds still fail loudly.',
|
|
})
|
|
@IsOptional()
|
|
@IsBoolean()
|
|
keepDeferredLinked?: boolean;
|
|
|
|
@ApiPropertyOptional({ type: [ContainerPlacementDto] })
|
|
@IsOptional()
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => ContainerPlacementDto)
|
|
containerPlacements?: ContainerPlacementDto[];
|
|
|
|
@ApiPropertyOptional({ description: 'Maximum total booking weight allowed on this train' })
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsNumber()
|
|
@Min(1)
|
|
maxTrainWeightTons?: number;
|
|
|
|
@ApiPropertyOptional({ description: 'Maximum total wagon length allowed on this train' })
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsNumber()
|
|
@Min(1)
|
|
maxTrainLengthMeters?: number;
|
|
|
|
@ApiPropertyOptional({ description: 'Maximum wagons allowed on this train' })
|
|
@IsOptional()
|
|
@Type(() => Number)
|
|
@IsInt()
|
|
@Min(1)
|
|
maxWagonsPerTrain?: number;
|
|
}
|