mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 12:41:04 +00:00
137 lines
3.1 KiB
TypeScript
137 lines
3.1 KiB
TypeScript
import { ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { Transform } from 'class-transformer';
|
|
import { IsInt, IsNumber, IsOptional, Min } from 'class-validator';
|
|
|
|
const toNumber = ({ value }: { value: unknown }) =>
|
|
value === '' || value == null ? value : Number(value);
|
|
|
|
/**
|
|
* Every field optional — the backoffice form PATCHes only what changed. A
|
|
* standard of zero is rejected: it would make every implement-rate division
|
|
* blow up or read as infinite achievement.
|
|
*/
|
|
export class UpdateOperationsStandardsDto {
|
|
@ApiPropertyOptional({ example: 10 })
|
|
@IsOptional()
|
|
@Transform(toNumber)
|
|
@IsNumber()
|
|
@Min(0.01)
|
|
stationStandardHoursEthiopia?: number;
|
|
|
|
@ApiPropertyOptional({ example: 13 })
|
|
@IsOptional()
|
|
@Transform(toNumber)
|
|
@IsNumber()
|
|
@Min(0.01)
|
|
stationStandardHoursDjibouti?: number;
|
|
|
|
@ApiPropertyOptional({ example: 65 })
|
|
@IsOptional()
|
|
@Transform(toNumber)
|
|
@IsNumber()
|
|
@Min(0.01)
|
|
cycleStandardHoursContainer?: number;
|
|
|
|
@ApiPropertyOptional({ example: 88 })
|
|
@IsOptional()
|
|
@Transform(toNumber)
|
|
@IsNumber()
|
|
@Min(0.01)
|
|
cycleStandardHoursBulkDmp?: number;
|
|
|
|
@ApiPropertyOptional({ example: 96 })
|
|
@IsOptional()
|
|
@Transform(toNumber)
|
|
@IsNumber()
|
|
@Min(0.01)
|
|
cycleStandardHoursBulkNagad?: number;
|
|
|
|
@ApiPropertyOptional({ example: 96 })
|
|
@IsOptional()
|
|
@Transform(toNumber)
|
|
@IsNumber()
|
|
@Min(0.01)
|
|
cycleStandardHoursBulkBcc?: number;
|
|
|
|
@ApiPropertyOptional({ example: 21 })
|
|
@IsOptional()
|
|
@Transform(toNumber)
|
|
@IsNumber()
|
|
@Min(0.01)
|
|
defaultLegStandardHours?: number;
|
|
|
|
@ApiPropertyOptional({ example: 30 })
|
|
@IsOptional()
|
|
@Transform(toNumber)
|
|
@IsInt()
|
|
@Min(0)
|
|
delayToleranceMinutes?: number;
|
|
|
|
/**
|
|
* Handling standards have no spec figure, so they are the only two that may
|
|
* be cleared: null puts the report back to reporting hours without a rate.
|
|
*/
|
|
@ApiPropertyOptional({ example: 6.75, nullable: true })
|
|
@IsOptional()
|
|
@Transform(toNumber)
|
|
@IsNumber()
|
|
@Min(0.01)
|
|
handlingStandardHoursContainer?: number | null;
|
|
|
|
@ApiPropertyOptional({ example: 12, nullable: true })
|
|
@IsOptional()
|
|
@Transform(toNumber)
|
|
@IsNumber()
|
|
@Min(0.01)
|
|
handlingStandardHoursBulk?: number | null;
|
|
|
|
@ApiPropertyOptional({ example: 20 })
|
|
@IsOptional()
|
|
@Transform(toNumber)
|
|
@IsNumber()
|
|
@Min(0.01)
|
|
chargedTonsFull20ft?: number;
|
|
|
|
@ApiPropertyOptional({ example: 40 })
|
|
@IsOptional()
|
|
@Transform(toNumber)
|
|
@IsNumber()
|
|
@Min(0.01)
|
|
chargedTonsFull40ft?: number;
|
|
|
|
@ApiPropertyOptional({ example: 2.24 })
|
|
@IsOptional()
|
|
@Transform(toNumber)
|
|
@IsNumber()
|
|
@Min(0.01)
|
|
chargedTonsEmpty20ft?: number;
|
|
|
|
@ApiPropertyOptional({ example: 3.88 })
|
|
@IsOptional()
|
|
@Transform(toNumber)
|
|
@IsNumber()
|
|
@Min(0.01)
|
|
chargedTonsEmpty40ft?: number;
|
|
|
|
@ApiPropertyOptional({ example: 70 })
|
|
@IsOptional()
|
|
@Transform(toNumber)
|
|
@IsNumber()
|
|
@Min(0.01)
|
|
chargedTonsPerWagonGeneral?: number;
|
|
|
|
@ApiPropertyOptional({ example: 38 })
|
|
@IsOptional()
|
|
@Transform(toNumber)
|
|
@IsNumber()
|
|
@Min(0.01)
|
|
chargedTonsPerWagonPerishable?: number;
|
|
|
|
@ApiPropertyOptional({ example: 50 })
|
|
@IsOptional()
|
|
@Transform(toNumber)
|
|
@IsInt()
|
|
@Min(1)
|
|
defaultFullTrainsetWagons?: number;
|
|
}
|