mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 00:52:50 +00:00
feat: add wagon usage computation and maintenance logging features
- Implemented utility to calculate wagon usage metrics for train schedules. - Created for sending wagons to maintenance with optional notes. - Added unit tests for train builder maintenance functionalities, including formatting train run labels and building maintenance notes. - Developed component for merging train schedules with detailed previews and reasons for merging. - Introduced component for selecting wagons with search functionality and selection limits. - Created for displaying and filtering audit logs, including detailed views of individual log entries. - Added for handling API interactions related to audit logs, including fetching logs and entity types.
This commit is contained in:
@@ -15,6 +15,7 @@ import {
|
||||
PortalCustomer,
|
||||
TrainSchedulingCancel,
|
||||
TrainSchedulingCreate,
|
||||
TrainSchedulingEditTrainNumber,
|
||||
TrainSchedulingReschedule,
|
||||
TrainSchedulingRulesManage,
|
||||
TrainSchedulingUpdate,
|
||||
@@ -52,6 +53,8 @@ import { AvailableDaysForCargoQueryDto } from "../dto/available-days-for-cargo-q
|
||||
import { UpdateTrainSchedulingGlobalRulesDto } from "../dto/update-train-scheduling-global-rules.dto";
|
||||
import { UpdateScheduleWindowRuleDto } from "../dto/update-schedule-window-rule.dto";
|
||||
import { UpdateScheduleDateDto } from "../dto/update-schedule-date.dto";
|
||||
import { MergeScheduleTrainDto } from "../dto/merge-schedule-train.dto";
|
||||
import { UpdateScheduleTrainNumberDto } from "../dto/update-schedule-train-number.dto";
|
||||
import { MaintenanceRescheduleDto } from "../dto/maintenance-reschedule.dto";
|
||||
import { TrainSchedulingService } from "../services/train-scheduling.service";
|
||||
import { BookingBatchService } from "../booking-batch.service";
|
||||
@@ -795,6 +798,47 @@ export class TrainSchedulingController {
|
||||
return this.trainSchedulingService.getContainerTrainScheduleById(id);
|
||||
}
|
||||
|
||||
@Patch("schedules/:id/train-number")
|
||||
@TrainSchedulingEditTrainNumber()
|
||||
@ApiOperation({
|
||||
summary:
|
||||
"Edit a departure's train number and voyage number — allowed only until the train is dispatched",
|
||||
})
|
||||
async updateScheduleTrainNumber(
|
||||
@Param("id", ParseUUIDPipe) id: string,
|
||||
@Body() dto: UpdateScheduleTrainNumberDto,
|
||||
) {
|
||||
await this.trainSchedulingService.updateScheduleTrainNumber(id, dto);
|
||||
return this.trainSchedulingService.getContainerTrainScheduleById(id);
|
||||
}
|
||||
|
||||
@Get("schedules/:id/merge-preview/:targetTrainId")
|
||||
@TrainSchedulingUpdate()
|
||||
@ApiOperation({
|
||||
summary:
|
||||
"What merging a train into this schedule would do — affected schedules, wagon totals and any blocking reasons. Read-only.",
|
||||
})
|
||||
async previewScheduleMerge(
|
||||
@Param("id", ParseUUIDPipe) id: string,
|
||||
@Param("targetTrainId", ParseUUIDPipe) targetTrainId: string,
|
||||
) {
|
||||
return this.trainSchedulingService.previewMerge(id, targetTrainId);
|
||||
}
|
||||
|
||||
@Post("schedules/:id/merge")
|
||||
@TrainSchedulingUpdate()
|
||||
@ApiOperation({
|
||||
summary:
|
||||
"Merge another train into this schedule: its wagons join this consist, a same-day schedule on it is absorbed, and the emptied train is deactivated",
|
||||
})
|
||||
async mergeScheduleTrain(
|
||||
@Param("id", ParseUUIDPipe) id: string,
|
||||
@Body() dto: MergeScheduleTrainDto,
|
||||
) {
|
||||
await this.trainSchedulingService.mergeScheduleTrain(id, dto);
|
||||
return this.trainSchedulingService.getContainerTrainScheduleById(id);
|
||||
}
|
||||
|
||||
@Post("schedules/:id/maintenance")
|
||||
@TrainSchedulingReschedule()
|
||||
@ApiOperation({
|
||||
|
||||
Reference in New Issue
Block a user