xpeditis2.0/apps/backend/src/application/dto/booking-response.dto.ts
David-Henri ARNAUD 1044900e98 feature phase
2025-10-08 16:56:27 +02:00

185 lines
4.4 KiB
TypeScript

import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { PortDto, PricingDto } from './rate-search-response.dto';
export class BookingAddressDto {
@ApiProperty({ example: '123 Main Street' })
street: string;
@ApiProperty({ example: 'Rotterdam' })
city: string;
@ApiProperty({ example: '3000 AB' })
postalCode: string;
@ApiProperty({ example: 'NL' })
country: string;
}
export class BookingPartyDto {
@ApiProperty({ example: 'Acme Corporation' })
name: string;
@ApiProperty({ type: BookingAddressDto })
address: BookingAddressDto;
@ApiProperty({ example: 'John Doe' })
contactName: string;
@ApiProperty({ example: 'john.doe@acme.com' })
contactEmail: string;
@ApiProperty({ example: '+31612345678' })
contactPhone: string;
}
export class BookingContainerDto {
@ApiProperty({ example: '550e8400-e29b-41d4-a716-446655440000' })
id: string;
@ApiProperty({ example: '40HC' })
type: string;
@ApiPropertyOptional({ example: 'ABCU1234567' })
containerNumber?: string;
@ApiPropertyOptional({ example: 22000 })
vgm?: number;
@ApiPropertyOptional({ example: -18 })
temperature?: number;
@ApiPropertyOptional({ example: 'SEAL123456' })
sealNumber?: string;
}
export class BookingRateQuoteDto {
@ApiProperty({ example: '550e8400-e29b-41d4-a716-446655440000' })
id: string;
@ApiProperty({ example: 'Maersk Line' })
carrierName: string;
@ApiProperty({ example: 'MAERSK' })
carrierCode: string;
@ApiProperty({ type: PortDto })
origin: PortDto;
@ApiProperty({ type: PortDto })
destination: PortDto;
@ApiProperty({ type: PricingDto })
pricing: PricingDto;
@ApiProperty({ example: '40HC' })
containerType: string;
@ApiProperty({ example: 'FCL' })
mode: string;
@ApiProperty({ example: '2025-02-15T10:00:00Z' })
etd: string;
@ApiProperty({ example: '2025-03-17T14:00:00Z' })
eta: string;
@ApiProperty({ example: 30 })
transitDays: number;
}
export class BookingResponseDto {
@ApiProperty({ example: '550e8400-e29b-41d4-a716-446655440000' })
id: string;
@ApiProperty({ example: 'WCM-2025-ABC123', description: 'Unique booking number' })
bookingNumber: string;
@ApiProperty({
example: 'draft',
enum: ['draft', 'pending_confirmation', 'confirmed', 'in_transit', 'delivered', 'cancelled'],
})
status: string;
@ApiProperty({ type: BookingPartyDto })
shipper: BookingPartyDto;
@ApiProperty({ type: BookingPartyDto })
consignee: BookingPartyDto;
@ApiProperty({ example: 'Electronics and consumer goods' })
cargoDescription: string;
@ApiProperty({ type: [BookingContainerDto] })
containers: BookingContainerDto[];
@ApiPropertyOptional({ example: 'Please handle with care. Delivery before 5 PM.' })
specialInstructions?: string;
@ApiProperty({ type: BookingRateQuoteDto, description: 'Associated rate quote details' })
rateQuote: BookingRateQuoteDto;
@ApiProperty({ example: '2025-02-15T10:00:00Z' })
createdAt: string;
@ApiProperty({ example: '2025-02-15T10:00:00Z' })
updatedAt: string;
}
export class BookingListItemDto {
@ApiProperty({ example: '550e8400-e29b-41d4-a716-446655440000' })
id: string;
@ApiProperty({ example: 'WCM-2025-ABC123' })
bookingNumber: string;
@ApiProperty({ example: 'draft' })
status: string;
@ApiProperty({ example: 'Acme Corporation' })
shipperName: string;
@ApiProperty({ example: 'Shanghai Imports Ltd' })
consigneeName: string;
@ApiProperty({ example: 'NLRTM' })
originPort: string;
@ApiProperty({ example: 'CNSHA' })
destinationPort: string;
@ApiProperty({ example: 'Maersk Line' })
carrierName: string;
@ApiProperty({ example: '2025-02-15T10:00:00Z' })
etd: string;
@ApiProperty({ example: '2025-03-17T14:00:00Z' })
eta: string;
@ApiProperty({ example: 1700.0 })
totalAmount: number;
@ApiProperty({ example: 'USD' })
currency: string;
@ApiProperty({ example: '2025-02-15T10:00:00Z' })
createdAt: string;
}
export class BookingListResponseDto {
@ApiProperty({ type: [BookingListItemDto] })
bookings: BookingListItemDto[];
@ApiProperty({ example: 25, description: 'Total number of bookings' })
total: number;
@ApiProperty({ example: 1, description: 'Current page number' })
page: number;
@ApiProperty({ example: 20, description: 'Items per page' })
pageSize: number;
@ApiProperty({ example: 2, description: 'Total number of pages' })
totalPages: number;
}