mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-09-06 13:35:03 +00:00
55 lines
1.7 KiB
TypeScript
55 lines
1.7 KiB
TypeScript
import { api as client } from "../auth/http";
|
|
import { unwrap } from "@/utils/endpoint";
|
|
import { URL_CONSTANTS } from "@/constants/URLS";
|
|
import type { ApiResponse } from "@/types/apiResponse";
|
|
|
|
const BASE = URL_CONSTANTS.OPERATIONS_STANDARDS.BASE;
|
|
|
|
/**
|
|
* The railway's operating standards — the numbers the operations reports
|
|
* measure actual performance against. One row, edited here.
|
|
*/
|
|
export interface OperationsStandards {
|
|
id: string;
|
|
stationStandardHoursEthiopia: number;
|
|
stationStandardHoursDjibouti: number;
|
|
cycleStandardHoursContainer: number;
|
|
cycleStandardHoursBulkDmp: number;
|
|
cycleStandardHoursBulkNagad: number;
|
|
cycleStandardHoursBulkBcc: number;
|
|
defaultLegStandardHours: number;
|
|
delayToleranceMinutes: number;
|
|
/** Null until a planner sets one — the spec names no handling standard. */
|
|
handlingStandardHoursContainer: number | null;
|
|
handlingStandardHoursBulk: number | null;
|
|
chargedTonsFull20ft: number;
|
|
chargedTonsFull40ft: number;
|
|
chargedTonsEmpty20ft: number;
|
|
chargedTonsEmpty40ft: number;
|
|
chargedTonsPerWagonGeneral: number;
|
|
chargedTonsPerWagonPerishable: number;
|
|
defaultFullTrainsetWagons: number;
|
|
updatedAt?: string;
|
|
}
|
|
|
|
export type OperationsStandardsPatch = Partial<
|
|
Omit<OperationsStandards, "id" | "updatedAt">
|
|
>;
|
|
|
|
export const operationsStandardsService = {
|
|
get: async (): Promise<OperationsStandards> => {
|
|
const response = await client.get<ApiResponse<OperationsStandards>>(BASE);
|
|
return unwrap(response.data);
|
|
},
|
|
|
|
update: async (
|
|
patch: OperationsStandardsPatch,
|
|
): Promise<OperationsStandards> => {
|
|
const response = await client.patch<ApiResponse<OperationsStandards>>(
|
|
BASE,
|
|
patch,
|
|
);
|
|
return unwrap(response.data);
|
|
},
|
|
};
|