mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 05:18:11 +00:00
fix rate edit
This commit is contained in:
@@ -600,7 +600,24 @@ export class TrainSchedulingService {
|
||||
}
|
||||
|
||||
async getTrainSchedulingGlobalRules() {
|
||||
return this.loadGlobalRulesRow();
|
||||
return this.toPublicGlobalRules(await this.loadGlobalRulesRow());
|
||||
}
|
||||
|
||||
/**
|
||||
* Train length/weight and 20ft weight caps are engine-internal (wagon
|
||||
* planning still reads them off the row); they are no longer exposed or
|
||||
* editable through the global-rules endpoints.
|
||||
*/
|
||||
private toPublicGlobalRules(row: TrainSchedulingGlobalRules | null) {
|
||||
if (!row) return row;
|
||||
const {
|
||||
maxTrainLengthMeters: _len,
|
||||
maxTrainWeightTons: _wt,
|
||||
max20ftContainerWeightTons: _cw,
|
||||
max20ftPairWeightDiffTons: _pd,
|
||||
...pub
|
||||
} = row;
|
||||
return pub;
|
||||
}
|
||||
|
||||
async updateTrainSchedulingGlobalRules(dto: UpdateTrainSchedulingGlobalRulesDto) {
|
||||
@@ -608,15 +625,7 @@ export class TrainSchedulingService {
|
||||
if (!row) {
|
||||
throw new NotFoundException('Train scheduling global rules not configured');
|
||||
}
|
||||
if (dto.maxTrainLengthMeters != null) row.maxTrainLengthMeters = dto.maxTrainLengthMeters;
|
||||
if (dto.maxTrainWeightTons != null) row.maxTrainWeightTons = dto.maxTrainWeightTons;
|
||||
if (dto.maxWagonsPerTrain != null) row.maxWagonsPerTrain = dto.maxWagonsPerTrain;
|
||||
if (dto.max20ftContainerWeightTons != null) {
|
||||
row.max20ftContainerWeightTons = dto.max20ftContainerWeightTons;
|
||||
}
|
||||
if (dto.max20ftPairWeightDiffTons != null) {
|
||||
row.max20ftPairWeightDiffTons = dto.max20ftPairWeightDiffTons;
|
||||
}
|
||||
if (dto.importWindowLeadDays != null) row.importWindowLeadDays = dto.importWindowLeadDays;
|
||||
if (dto.exportBookingLeadHours != null) row.exportBookingLeadHours = dto.exportBookingLeadHours;
|
||||
if (dto.windowOpenHour != null) row.windowOpenHour = dto.windowOpenHour;
|
||||
@@ -654,7 +663,7 @@ export class TrainSchedulingService {
|
||||
await this.restampPendingWindows();
|
||||
}
|
||||
|
||||
return saved;
|
||||
return this.toPublicGlobalRules(saved);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user