Merge pull request #1453 from Tria-plc/freight_feature/usermanagement

Freight feature/usermanagement
This commit is contained in:
marshal
2026-08-29 10:40:53 +03:00
committed by GitHub
66 changed files with 6593 additions and 337 deletions

View File

@@ -2320,12 +2320,18 @@ export class TrainSchedulingService {
// batch fill, which unlinks it and frees its wagons on the next window cycle.
const scheduledAt = new Date();
for (const booking of bookings) {
const wagonsRequired = sumWagonsRequired(booking, wagonPlan);
await this.bookingsRepository.updateSchedulingFields(
booking.id,
{
schedulingStatus: SchedulingStatus.Scheduled,
scheduledAt,
wagonsRequired: sumWagonsRequired(booking, wagonPlan),
wagonsRequired,
// Pinned for cancellation pricing: unassign clears wagonsRequired,
// this stays. Written once — re-allocation keeps the first stamp.
...(Number(booking.cancellationWagons ?? 0) > 0
? {}
: { cancellationWagons: wagonsRequired }),
},
manager,
);