mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 19:58:11 +00:00
52 lines
1.2 KiB
TypeScript
52 lines
1.2 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
import {
|
|
ArrayMinSize,
|
|
IsArray,
|
|
IsOptional,
|
|
IsString,
|
|
IsUUID,
|
|
MaxLength,
|
|
} from 'class-validator';
|
|
|
|
export class BuildTrainDto {
|
|
@ApiProperty({ example: '81001', description: 'Operator-assigned train code (unique)' })
|
|
@IsString()
|
|
@MaxLength(32)
|
|
code!: string;
|
|
|
|
@ApiProperty({ format: 'uuid', description: 'Yard the train is built in' })
|
|
@IsUUID()
|
|
currentYardId!: string;
|
|
|
|
@ApiProperty({
|
|
type: [String],
|
|
format: 'uuid',
|
|
description: 'Locomotives pulling the train (minimum 2 — front and back), in consist order',
|
|
})
|
|
@IsArray()
|
|
@ArrayMinSize(2, { message: 'A train must be pulled by at least two locomotives' })
|
|
@IsUUID('all', { each: true })
|
|
locomotiveIds!: string[];
|
|
|
|
@ApiPropertyOptional({
|
|
type: [String],
|
|
format: 'uuid',
|
|
description: 'Wagons to attach at build time, in consist order (must sit in the same yard)',
|
|
})
|
|
@IsOptional()
|
|
@IsArray()
|
|
@IsUUID('all', { each: true })
|
|
wagonIds?: string[];
|
|
|
|
@ApiPropertyOptional({ maxLength: 100 })
|
|
@IsOptional()
|
|
@IsString()
|
|
@MaxLength(100)
|
|
trainName?: string;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
notes?: string;
|
|
}
|