Some checks are pending
CD Production (Hetzner k3s) / Promote Images (preprod → prod) (push) Waiting to run
CD Production (Hetzner k3s) / Deploy to k3s (xpeditis-prod) (push) Blocked by required conditions
CD Production (Hetzner k3s) / Smoke Tests (push) Blocked by required conditions
CD Production (Hetzner k3s) / Deployment Summary (push) Blocked by required conditions
CD Production (Hetzner k3s) / Notify Success (push) Blocked by required conditions
CD Production (Hetzner k3s) / Notify Failure (push) Blocked by required conditions
Aligns main with the complete application codebase (cicd branch). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
64 lines
2.0 KiB
TypeScript
64 lines
2.0 KiB
TypeScript
import { RateQuote } from '@domain/entities/rate-quote.entity';
|
|
import { RateQuoteDto } from '../dto/rate-search-response.dto';
|
|
|
|
export class RateQuoteMapper {
|
|
/**
|
|
* Map domain RateQuote entity to DTO
|
|
*/
|
|
static toDto(entity: RateQuote): RateQuoteDto {
|
|
return {
|
|
id: entity.id,
|
|
carrierId: entity.carrierId,
|
|
carrierName: entity.carrierName,
|
|
carrierCode: entity.carrierCode,
|
|
origin: {
|
|
code: entity.origin.code,
|
|
name: entity.origin.name,
|
|
country: entity.origin.country,
|
|
},
|
|
destination: {
|
|
code: entity.destination.code,
|
|
name: entity.destination.name,
|
|
country: entity.destination.country,
|
|
},
|
|
pricing: {
|
|
baseFreight: entity.pricing.baseFreight,
|
|
surcharges: entity.pricing.surcharges.map(s => ({
|
|
type: s.type,
|
|
description: s.description,
|
|
amount: s.amount,
|
|
currency: s.currency,
|
|
})),
|
|
totalAmount: entity.pricing.totalAmount,
|
|
currency: entity.pricing.currency,
|
|
},
|
|
containerType: entity.containerType,
|
|
mode: entity.mode,
|
|
etd: entity.etd.toISOString(),
|
|
eta: entity.eta.toISOString(),
|
|
transitDays: entity.transitDays,
|
|
route: entity.route.map(segment => ({
|
|
portCode: segment.portCode,
|
|
portName: segment.portName,
|
|
arrival: segment.arrival?.toISOString(),
|
|
departure: segment.departure?.toISOString(),
|
|
vesselName: segment.vesselName,
|
|
voyageNumber: segment.voyageNumber,
|
|
})),
|
|
availability: entity.availability,
|
|
frequency: entity.frequency,
|
|
vesselType: entity.vesselType,
|
|
co2EmissionsKg: entity.co2EmissionsKg,
|
|
validUntil: entity.validUntil.toISOString(),
|
|
createdAt: entity.createdAt.toISOString(),
|
|
};
|
|
}
|
|
|
|
/**
|
|
* Map array of RateQuote entities to DTOs
|
|
*/
|
|
static toDtoArray(entities: RateQuote[]): RateQuoteDto[] {
|
|
return entities.map(entity => this.toDto(entity));
|
|
}
|
|
}
|