mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-02 08:03:42 +00:00
export flow and fix intercity issue
This commit is contained in:
@@ -1046,6 +1046,13 @@ export class BookingTransitionService {
|
||||
async exportTrainsForBooking(
|
||||
bookingId: string,
|
||||
scheduledDate: string,
|
||||
overrides?: {
|
||||
containerTypeIds?: string[];
|
||||
containerSizes?: string[];
|
||||
cargoTypeId?: string;
|
||||
cargoTypeCode?: string;
|
||||
wagons?: number;
|
||||
},
|
||||
): Promise<ExportTrainOption[]> {
|
||||
const booking = await this.bookingsService.findById(bookingId);
|
||||
const date = new Date(scheduledDate);
|
||||
@@ -1064,6 +1071,7 @@ export class BookingTransitionService {
|
||||
return this.bookingBatchService.exportTrainOptionsForDay(
|
||||
scheduledBooking,
|
||||
eatDay(date),
|
||||
overrides,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -765,8 +765,26 @@ export class BookingsController {
|
||||
async exportTrainsForBooking(
|
||||
@Param("id", ParseUUIDPipe) id: string,
|
||||
@Query("date") date: string,
|
||||
// Bare contract instances carry no cargo yet — the completion form sends
|
||||
// what the customer is entering so per-type space reflects THEIR cargo.
|
||||
@Query("containerTypeIds") containerTypeIds?: string,
|
||||
@Query("containerSizes") containerSizes?: string,
|
||||
@Query("cargoTypeId") cargoTypeId?: string,
|
||||
@Query("cargoTypeCode") cargoTypeCode?: string,
|
||||
@Query("wagons") wagons?: string,
|
||||
) {
|
||||
return this.transitionService.exportTrainsForBooking(id, date);
|
||||
const parsedWagons = Number(wagons);
|
||||
return this.transitionService.exportTrainsForBooking(id, date, {
|
||||
containerTypeIds: containerTypeIds
|
||||
? containerTypeIds.split(",").filter(Boolean)
|
||||
: undefined,
|
||||
containerSizes: containerSizes
|
||||
? containerSizes.split(",").filter(Boolean)
|
||||
: undefined,
|
||||
cargoTypeId: cargoTypeId || undefined,
|
||||
cargoTypeCode: cargoTypeCode || undefined,
|
||||
wagons: Number.isFinite(parsedWagons) && parsedWagons > 0 ? parsedWagons : undefined,
|
||||
});
|
||||
}
|
||||
|
||||
@Post(":id/operation/review")
|
||||
|
||||
Reference in New Issue
Block a user