Files
edr-platform/apps/edr-freight-api/src/modules/wagons/dto/create-wagon.dto.ts
2026-07-17 08:47:52 +00:00

45 lines
916 B
TypeScript

import { WagonStatus } from '@edr/types';
import { IsString, IsUUID, IsOptional, IsInt, Min, IsEnum } from 'class-validator';
export class CreateWagonDto {
@IsString()
wagonNumber!: string;
@IsUUID()
wagonTypeId!: string;
@IsOptional()
@IsUUID()
trainId?: string;
@IsOptional()
@IsInt()
@Min(1)
sequenceNumber?: number;
// Tare weight and payload capacity are not accepted here: they belong to the
// wagon type and are resolved through wagonTypeId.
/** EXPORT run number — odd, Ethiopia → Djibouti (e.g. 8001). */
@IsOptional()
@IsString()
exportTrainNumber?: string;
/** IMPORT run number — even, Djibouti → Ethiopia (e.g. 8002). */
@IsOptional()
@IsString()
importTrainNumber?: string;
@IsOptional()
@IsEnum(WagonStatus)
status?: WagonStatus;
@IsOptional()
@IsUUID()
currentYardId?: string;
@IsOptional()
@IsString()
notes?: string;
}