mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-28 14:50:57 +00:00
changes
This commit is contained in:
@@ -202,15 +202,22 @@ export class GlOperationsService {
|
||||
.findOne({ where: { id: booking.trainScheduleId } });
|
||||
}
|
||||
|
||||
// Per-booking journey first: a booking rides only its own leg, so ITS
|
||||
// loaded/arrived timestamps gate clearance — a Dire→Djibouti booking that
|
||||
// unloaded at its own destination clears while the train keeps rolling,
|
||||
// and a booking still on board does NOT clear just because the train
|
||||
// arrived. The schedule actuals remain only as fallback for legacy
|
||||
// in-flight bookings that predate per-booking load/unload (no loadedAt).
|
||||
const departedAt = booking.loadedAt ?? schedule?.actualDepartureAt ?? null;
|
||||
const arrivedAt =
|
||||
booking.arrivedAt ??
|
||||
(booking.loadedAt ? null : (schedule?.actualArrivalAt ?? null));
|
||||
|
||||
return {
|
||||
scheduleId: schedule?.id ?? null,
|
||||
wagonAllocated,
|
||||
departedAt: schedule?.actualDepartureAt
|
||||
? new Date(schedule.actualDepartureAt).toISOString()
|
||||
: null,
|
||||
arrivedAt: schedule?.actualArrivalAt
|
||||
? new Date(schedule.actualArrivalAt).toISOString()
|
||||
: null,
|
||||
departedAt: departedAt ? new Date(departedAt).toISOString() : null,
|
||||
arrivedAt: arrivedAt ? new Date(arrivedAt).toISOString() : null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -278,7 +285,7 @@ export class GlOperationsService {
|
||||
/**
|
||||
* GL Djibouti uploads T1 transport documents (multi-file) once the gate pass
|
||||
* is secured on the train schedule (which itself follows wagon allocation).
|
||||
* Replaces the previous batch; locked once the train departs or T1 is closed.
|
||||
* Replaces the previous batch; locked only once GL Ethiopia closes the T1.
|
||||
*/
|
||||
async uploadT1Documents(
|
||||
bookingId: string,
|
||||
@@ -304,11 +311,8 @@ export class GlOperationsService {
|
||||
if (state.closed) {
|
||||
throw new BadRequestException('T1 has been closed by GL Ethiopia — documents are final.');
|
||||
}
|
||||
if (state.trainDepartedAt) {
|
||||
throw new BadRequestException(
|
||||
'The train has departed — T1 transport documents can no longer be changed.',
|
||||
);
|
||||
}
|
||||
// Departure no longer locks T1 docs — GL DJ may replace them any time until
|
||||
// GL Ethiopia closes/accepts the T1.
|
||||
|
||||
await persistT1TransportUploads(this.filesService, bookingId, files);
|
||||
return { uploaded: files.length };
|
||||
|
||||
@@ -276,6 +276,7 @@ export const PHASED_CUSTOMS_BOOKING_QUEUE_STATUSES = [
|
||||
'OPERATION_CHANGES_REQUESTED',
|
||||
'ROAD_DISPATCH_PENDING',
|
||||
'IN_TRANSIT',
|
||||
'ARRIVED',
|
||||
'PAID',
|
||||
'COMPLETED',
|
||||
'CONTRACT_ACTIVE',
|
||||
|
||||
Reference in New Issue
Block a user