fix train builder and consolidation

This commit is contained in:
Marshal
2026-07-14 13:49:39 +00:00
parent 01459bd73c
commit 5cffe2860c
14 changed files with 1092 additions and 17 deletions

View File

@@ -39,6 +39,7 @@ import {
UploadImportDjiboutiDocumentDto,
} from "./dto/import-djibouti-operation.dto";
import { AvailableLocomotivesQueryDto } from "./dto/available-locomotives-query.dto";
import { AdjustScheduleConsistDto } from "./dto/adjust-schedule-consist.dto";
import { AvailableTrainsQueryDto } from "./dto/available-trains-query.dto";
import { BatchBoardQueryDto } from "./dto/batch-board-query.dto";
import { BookableSchedulesQueryDto } from "./dto/bookable-schedules-query.dto";
@@ -166,6 +167,34 @@ export class TrainSchedulingController {
);
}
@Get("schedules/:id/consist")
@TrainSchedulingView()
@ApiOperation({
summary:
"Built-train consist snapshot for a schedule: gross weight/length vs locomotive limits (incl. tolerance), trimmable + addable wagons, adjustment history",
})
getScheduleConsist(@Param("id", ParseUUIDPipe) id: string) {
return this.trainSchedulingService.getScheduleConsist(id);
}
@Post("schedules/:id/adjust-consist")
@TrainSchedulingManage()
@ApiOperation({
summary:
"Permanently trim free wagons off / couple yard wagons onto the schedule's built train (weight & length limits incl. tolerance enforced, every change logged)",
})
adjustScheduleConsist(
@Param("id", ParseUUIDPipe) id: string,
@Body() dto: AdjustScheduleConsistDto,
@CurrentUser() user: AuthUserPayload,
) {
return this.trainSchedulingService.adjustScheduleConsist(
id,
dto,
resolveAuthUserId(user),
);
}
@Get("bookable-schedules")
// No staff guard: customers hit this while creating a booking to find OPEN
// same-route schedules. Do not attach train_scheduling permissions here.