xpeditis2.0/apps/backend/src/application/mappers/rate-quote.mapper.ts
David 4b00ee2601
Some checks failed
CI/CD Pipeline - Xpeditis PreProd / Frontend - Docker Build & Push (push) Blocked by required conditions
CI/CD Pipeline - Xpeditis PreProd / Deploy to PreProd Server (push) Blocked by required conditions
CI/CD Pipeline - Xpeditis PreProd / Run Smoke Tests (push) Blocked by required conditions
CI/CD Pipeline - Xpeditis PreProd / Backend - Build & Test (push) Failing after 5m53s
CI/CD Pipeline - Xpeditis PreProd / Backend - Docker Build & Push (push) Has been skipped
CI/CD Pipeline - Xpeditis PreProd / Frontend - Build & Test (push) Has been cancelled
fix: replace relative domain imports with TypeScript path aliases
- Replace all ../../domain/ imports with @domain/ across 67 files
- Configure NestJS to use tsconfig.build.json with rootDir
- Add tsc-alias to resolve path aliases after build
- This fixes 'Cannot find module' TypeScript compilation errors

Fixed files:
- 30 files in application layer
- 37 files in infrastructure layer
2025-11-16 19:20:58 +01:00

70 lines
2.0 KiB
TypeScript

import { RateQuote } from '@domain/entities/rate-quote.entity';
import {
RateQuoteDto,
PortDto,
SurchargeDto,
PricingDto,
RouteSegmentDto,
} 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));
}
}