Files
edr-platform/apps/edr-freight-api/src/modules/bookings/dto/booking-reference-data.dto.ts
2026-07-17 09:16:35 +00:00

106 lines
2.5 KiB
TypeScript

import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { CargoUnitOfMeasure } from '@edr/types';
export class BookingReferenceYardDto {
@ApiProperty({ format: 'uuid' })
id!: string;
@ApiProperty({ example: 'Mojo Dry Port' })
name!: string;
@ApiProperty({ example: 'MOJO' })
code!: string;
@ApiProperty({ example: 'Ethiopia' })
country!: string;
}
export class BookingReferenceContainerTypeDto {
@ApiProperty({ format: 'uuid' })
id!: string;
@ApiProperty({ example: 'Dry' })
name!: string;
@ApiProperty({ example: '20GP' })
code!: string;
@ApiProperty()
is_reefer!: boolean;
}
export class BookingReferenceContainerSizeGroupDto {
@ApiProperty({ example: '20ft' })
size!: string;
@ApiProperty({ type: [BookingReferenceContainerTypeDto] })
types!: BookingReferenceContainerTypeDto[];
}
export class BookingReferenceServiceDto {
@ApiProperty({ format: 'uuid' })
id!: string;
@ApiProperty({ example: 'Rail Transport Only' })
name!: string;
@ApiProperty({ example: 'RAIL' })
code!: string;
}
export class BookingReferenceShippingLineDto {
@ApiProperty({ format: 'uuid' })
id!: string;
@ApiProperty({ example: 'MSC' })
name!: string;
@ApiProperty({ example: 'MSC' })
code!: string;
}
export class BookingReferenceCargoTypeChildDto {
@ApiProperty({ format: 'uuid' })
id!: string;
@ApiProperty({ example: 'Coffee' })
name!: string;
@ApiProperty({ example: 'BULK_COFFEE' })
code!: string;
@ApiProperty({ enum: CargoUnitOfMeasure, nullable: true, required: false })
unit_of_measure?: CargoUnitOfMeasure | null;
}
export class BookingReferenceCargoTypeGroupDto {
@ApiProperty({ format: 'uuid' })
id!: string;
@ApiProperty({ example: 'Bulk Cargo' })
name!: string;
@ApiProperty({ example: 'BULK' })
code!: string;
@ApiPropertyOptional({ type: [BookingReferenceCargoTypeChildDto] })
children?: BookingReferenceCargoTypeChildDto[];
}
export class BookingReferenceDataDto {
@ApiProperty({ type: [BookingReferenceYardDto] })
yard!: BookingReferenceYardDto[];
@ApiProperty({ type: [BookingReferenceContainerSizeGroupDto] })
containers!: BookingReferenceContainerSizeGroupDto[];
@ApiProperty({ type: [BookingReferenceServiceDto] })
service!: BookingReferenceServiceDto[];
@ApiProperty({ type: [BookingReferenceShippingLineDto] })
shipping_line!: BookingReferenceShippingLineDto[];
@ApiProperty({ type: [BookingReferenceCargoTypeGroupDto] })
cargo_type!: BookingReferenceCargoTypeGroupDto[];
}