mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 22:30:55 +00:00
- Create migration for booking_requests table with necessary fields and indexes. - Implement BookingRequestRepository for database operations related to booking requests. - Develop BookingRequestService to handle business logic for submitting, accepting, rejecting, and canceling booking requests. - Create DTOs for creating booking requests and reviewing them. - Define BookingRequest entity to map to the booking_requests table. - Add UI components for managing shipment requests, including detail and list pages. - Implement OperationDatePicker component for selecting available shipment days.
106 lines
2.4 KiB
TypeScript
106 lines
2.4 KiB
TypeScript
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
|
|
import { Transform, Type } from 'class-transformer';
|
|
import {
|
|
IsArray,
|
|
IsInt,
|
|
IsNumber,
|
|
IsOptional,
|
|
IsString,
|
|
IsUUID,
|
|
Min,
|
|
ValidateNested,
|
|
} from 'class-validator';
|
|
|
|
/** A requested container line (no per-unit data — GL enters that at booking). */
|
|
export class RequestContainerLineDto {
|
|
@ApiProperty({ description: '"20ft" | "40ft" — must be in the contract scope' })
|
|
@IsString()
|
|
containerSize!: string;
|
|
|
|
@ApiProperty({ minimum: 1 })
|
|
@IsInt()
|
|
@Min(1)
|
|
@Transform(({ value }) => Number(value))
|
|
quantity!: number;
|
|
|
|
@ApiPropertyOptional({ minimum: 0 })
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(0)
|
|
@Transform(({ value }) => Number(value))
|
|
hazardousQuantity?: number;
|
|
|
|
@ApiPropertyOptional({ minimum: 0 })
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(0)
|
|
@Transform(({ value }) => Number(value))
|
|
reeferQuantity?: number;
|
|
}
|
|
|
|
export class RequestBulkLineDto {
|
|
@ApiPropertyOptional({ format: 'uuid' })
|
|
@IsOptional()
|
|
@IsUUID()
|
|
cargoTypeId?: string | null;
|
|
|
|
@ApiPropertyOptional({ minimum: 0 })
|
|
@IsOptional()
|
|
@IsNumber()
|
|
@Min(0)
|
|
@Transform(({ value }) => Number(value))
|
|
cargoWeightTons?: number;
|
|
|
|
@ApiPropertyOptional({ minimum: 0 })
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(0)
|
|
@Transform(({ value }) => Number(value))
|
|
itemCount?: number;
|
|
|
|
@ApiPropertyOptional({ minimum: 0 })
|
|
@IsOptional()
|
|
@IsInt()
|
|
@Min(0)
|
|
@Transform(({ value }) => Number(value))
|
|
hazardousQuantity?: number;
|
|
}
|
|
|
|
/** Customer's shipment request on a GENERAL customs contract. */
|
|
export class CreateBookingRequestDto {
|
|
@ApiPropertyOptional({ format: 'uuid', description: 'Required for multi-route GENERAL.' })
|
|
@IsOptional()
|
|
@IsUUID()
|
|
contractRouteId?: string;
|
|
|
|
@ApiPropertyOptional({ description: 'Preferred shipment day (informational).' })
|
|
@IsOptional()
|
|
@IsString()
|
|
scheduledDate?: string;
|
|
|
|
@ApiPropertyOptional({ type: [RequestContainerLineDto] })
|
|
@IsOptional()
|
|
@IsArray()
|
|
@ValidateNested({ each: true })
|
|
@Type(() => RequestContainerLineDto)
|
|
containers?: RequestContainerLineDto[];
|
|
|
|
@ApiPropertyOptional({ type: RequestBulkLineDto })
|
|
@IsOptional()
|
|
@ValidateNested()
|
|
@Type(() => RequestBulkLineDto)
|
|
bulk?: RequestBulkLineDto;
|
|
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
notes?: string;
|
|
}
|
|
|
|
export class ReviewBookingRequestDto {
|
|
@ApiPropertyOptional()
|
|
@IsOptional()
|
|
@IsString()
|
|
note?: string;
|
|
}
|