implement Global Logistics booking process for customs contracts and enhance contract document handling

This commit is contained in:
Marshal
2026-06-29 08:08:10 +00:00
parent 4be4cc9054
commit aeb5e0046e
13 changed files with 436 additions and 104 deletions

View File

@@ -77,6 +77,13 @@ export class WagonsService {
async update(id: string, dto: UpdateWagonDto): Promise<Wagon> {
const wagon = await this.findById(id);
Object.assign(wagon, dto);
// `findById` eager-loads `currentYard`; when the DTO changes the scalar FK
// TypeORM otherwise re-derives `current_yard_id` from the STALE relation
// object (the old yard) on save and silently reverts the change. Drop the
// relation so the scalar `currentYardId` wins.
if (dto.currentYardId !== undefined) {
wagon.currentYard = null;
}
await this.wagonRepo.save(wagon);
// Re-read with the relation so the response reflects the new yard label
// instead of the stale relation object loaded before the assign.