fix(train-scheduling): marshalling doc 40ft/20ft counts were always 0

findByIdWithFullGraph loaded containerItems but not
containerItems.bookingContainer, so item.bookingContainer was always
undefined and the 40ft/20ft/total tallies on the Import/Export
Marshalling Document silently read as 0. Load containerType on both the
item and its bookingContainer, and resolve size from whichever is set.
This commit is contained in:
Hagernesh
2026-07-29 14:11:22 +00:00
parent 0551d2dd57
commit e2ad024da1
2 changed files with 37 additions and 7 deletions

View File

@@ -39,7 +39,11 @@ export class TrainSchedulesRepository extends BaseRepository<TrainSchedule> {
physicalWagon: true,
allocations: {
booking: { company: true, bookingContainers: { containerType: true } },
containerItems: true,
// Both size sources loaded: the item's own container_type_id FK
// (always set for a manually-entered item) and the booking-line
// fallback via bookingContainer.containerType — the marshalling
// document's 40ft/20ft tally reads whichever is present.
containerItems: { containerType: true, bookingContainer: { containerType: true } },
},
},
},