diff --git a/apps/edr-freight-api/src/modules/train-schedules/train-schedules.repository.ts b/apps/edr-freight-api/src/modules/train-schedules/train-schedules.repository.ts index 700a38983..a64faabbe 100644 --- a/apps/edr-freight-api/src/modules/train-schedules/train-schedules.repository.ts +++ b/apps/edr-freight-api/src/modules/train-schedules/train-schedules.repository.ts @@ -22,7 +22,9 @@ export class TrainSchedulesRepository extends BaseRepository { return this.repo(manager).findOne({ where: { id }, relations: { - route: true, + // Yards carry the route's display name; without them formatRouteLabel + // degrades to the literal "Origin → Destination". + route: { originYard: true, destinationYard: true }, trainSet: { locomotive: true, locomotives: { locomotive: true }, diff --git a/apps/edr-freight-api/src/modules/train-scheduling/booking-batch.service.ts b/apps/edr-freight-api/src/modules/train-scheduling/booking-batch.service.ts index 5fb2e7943..d043fed32 100644 --- a/apps/edr-freight-api/src/modules/train-scheduling/booking-batch.service.ts +++ b/apps/edr-freight-api/src/modules/train-scheduling/booking-batch.service.ts @@ -635,7 +635,8 @@ export class BookingBatchService implements OnModuleInit { trainSet: { locomotive: true }, originStation: true, destinationStation: true, - route: true, + // Yards supply the route's display name for `routeName` below. + route: { originYard: true, destinationYard: true }, }, order: { scheduledDepartureDate: "ASC" }, }); diff --git a/apps/edr-freight-api/src/modules/train-scheduling/train-scheduling.service.ts b/apps/edr-freight-api/src/modules/train-scheduling/train-scheduling.service.ts index 8ca6ba42d..d96c8062e 100644 --- a/apps/edr-freight-api/src/modules/train-scheduling/train-scheduling.service.ts +++ b/apps/edr-freight-api/src/modules/train-scheduling/train-scheduling.service.ts @@ -2634,7 +2634,8 @@ export class TrainSchedulingService { const schedules = await this.trainSchedulesRepository.findAll({ relations: { trainSet: { locomotive: true, locomotives: { locomotive: true } }, - route: true, + // Yards carry the route's display name used by mapScheduleListItem. + route: { originYard: true, destinationYard: true }, originStation: true, destinationStation: true, scheduleBookings: { booking: true },