fix(freight): gate loading on booking paymentStatus only; default schedule voyage no. to train's voyage number

This commit is contained in:
marshal
2026-09-02 21:15:48 +00:00
parent d51bed5630
commit 3e274cc2a2
30 changed files with 629 additions and 117 deletions

View File

@@ -270,7 +270,7 @@ export class SchedulingRescheduleService {
// M12: only announce a new departure when the date actually moved —
// `newDeparture` is null when the date was unchanged, so retained customers
// are not falsely told the train was rescheduled.
await this.notifyRescheduleOutcome(dto, newDeparture);
await this.notifyRescheduleOutcome(scheduleId, dto, newDeparture);
if (newDeparture) void this.trainSchedulingService.emitWindowState(scheduleId);
return { plan, schedule: assignResult };
@@ -283,6 +283,7 @@ export class SchedulingRescheduleService {
* company so the notifier has a phone/email to reach.
*/
private async notifyRescheduleOutcome(
scheduleId: string,
dto: ExecuteRescheduleDto,
newDeparture: Date | null,
): Promise<void> {
@@ -294,9 +295,9 @@ export class SchedulingRescheduleService {
const booking = await this.loadBookingForNotify(bookingId);
if (!booking) continue;
if (isMaintenance) {
this.notifier.maintenanceMoved(booking, newDeparture);
this.notifier.maintenanceMoved(booking, newDeparture, scheduleId, dto.reason);
} else {
this.notifier.rescheduled(booking, newDeparture);
this.notifier.rescheduled(booking, newDeparture, scheduleId, dto.reason);
}
}
}
@@ -307,7 +308,8 @@ export class SchedulingRescheduleService {
for (const bookingId of dto.displacedBookingIds) {
const booking = await this.loadBookingForNotify(bookingId);
if (!booking) continue;
this.notifier.removedFromTrain(booking);
// Displaced bookings no longer point at the schedule — pass it explicitly.
this.notifier.removedFromTrain(booking, scheduleId);
}
}
}