fix schule issue and contianer type issue

This commit is contained in:
Marshal
2026-07-17 09:16:35 +00:00
parent 5a1e0dba4d
commit 7b7e7c3f62
39 changed files with 508 additions and 187 deletions

View File

@@ -185,6 +185,7 @@ import { trainService, type Train } from "./trains.service";
import {
trainBuilderService,
type AdjustConsistPayload,
type AdjustConsistResult,
type AvailableTrain,
type BuildTrainPayload,
type BuiltTrainListFilters,
@@ -338,7 +339,7 @@ export const api = {
adjustConsist: endpoint<
{ scheduleId: string; payload: AdjustConsistPayload },
ScheduleConsist
AdjustConsistResult
>(
"train-scheduling",
"adjust-consist",

View File

@@ -235,6 +235,18 @@ export interface ScheduleConsist {
occurredAt: string;
}>;
editable: boolean;
/**
* Wagon-slot picture of the schedule: the consist IS the booking capacity
* (weight/length only bind while building the consist), so the dialog can
* project FULL / reopen / over-allocation live. Null on legacy schedules.
*/
scheduleCapacity: {
maxWagons: number;
allocatedWagons: number;
remainingSlots: number;
overAllocatedBy: number;
bookingWindowStatus: string | null;
} | null;
}
export interface AdjustConsistPayload {
@@ -242,6 +254,9 @@ export interface AdjustConsistPayload {
removeWagonIds?: string[];
}
/** Adjust response: fresh consist + schedule-impact warnings to surface. */
export type AdjustConsistResult = ScheduleConsist & { warnings: string[] };
export const trainBuilderService = {
list: (filters: BuiltTrainListFilters = {}) =>
apiClient.get<BuiltTrainListResponse>(`${BASE}${toQuery(filters)}`),
@@ -275,7 +290,7 @@ export const trainBuilderService = {
apiClient.get<ScheduleConsist>(`/train-scheduling/schedules/${scheduleId}/consist`),
/** Permanently trim/add wagons on the schedule's built train. */
adjustConsist: (scheduleId: string, payload: AdjustConsistPayload) =>
apiClient.post<ScheduleConsist>(
apiClient.post<AdjustConsistResult>(
`/train-scheduling/schedules/${scheduleId}/adjust-consist`,
payload,
),