mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 11:08:12 +00:00
implement wagon maintenance feature: add functionality to detach wagons and move them to maintenance status
This commit is contained in:
@@ -1850,6 +1850,15 @@ export const api = {
|
||||
() => TRAIN_BUILDER_INVALIDATIONS,
|
||||
),
|
||||
|
||||
sendWagonToMaintenance: endpoint<{ id: string; wagonId: string }, TrainComposition>(
|
||||
"train-builder",
|
||||
"sendWagonToMaintenance",
|
||||
({ id, wagonId }) =>
|
||||
trainBuilderService.sendWagonToMaintenance(id, wagonId).then((r) => r.data),
|
||||
undefined,
|
||||
() => TRAIN_BUILDER_INVALIDATIONS,
|
||||
),
|
||||
|
||||
reorderWagons: endpoint<{ id: string; wagonIds: string[] }, TrainComposition>(
|
||||
"train-builder",
|
||||
"reorderWagons",
|
||||
|
||||
@@ -129,7 +129,6 @@ export interface BuiltTrainListResponse {
|
||||
}
|
||||
|
||||
export interface BuildTrainPayload {
|
||||
code: string;
|
||||
/** EXPORT run number — odd, unique across trains (e.g. 8001). */
|
||||
exportTrainNumber: string;
|
||||
/** IMPORT run number — even, unique across trains (e.g. 8002). */
|
||||
@@ -249,6 +248,9 @@ export const trainBuilderService = {
|
||||
apiClient.post<TrainComposition>(`${BASE}/${id}/wagons`, { wagonIds }),
|
||||
removeWagon: (id: string, wagonId: string) =>
|
||||
apiClient.delete<TrainComposition>(`${BASE}/${id}/wagons/${wagonId}`),
|
||||
/** Detach a wagon and move it to MAINTENANCE status. */
|
||||
sendWagonToMaintenance: (id: string, wagonId: string) =>
|
||||
apiClient.post<TrainComposition>(`${BASE}/${id}/wagons/${wagonId}/maintenance`),
|
||||
reorderWagons: (id: string, wagonIds: string[]) =>
|
||||
apiClient.post<TrainComposition>(`${BASE}/${id}/reorder-wagons`, { wagonIds }),
|
||||
disband: (id: string) => apiClient.delete<void>(`${BASE}/${id}`),
|
||||
|
||||
Reference in New Issue
Block a user