mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 00:38:11 +00:00
Merge freight/develop into Warehouses
This commit is contained in:
@@ -35,6 +35,8 @@ import {
|
||||
type RejectStepPayload,
|
||||
} from "./bookings.service";
|
||||
import type { BookingDetail } from "@/types/booking";
|
||||
import type { IOverviewDashboard, OverviewRange } from "@/types/overview";
|
||||
import { overviewService } from "./overview.service";
|
||||
|
||||
export const api = {
|
||||
fileUploadSettings: {
|
||||
@@ -233,6 +235,20 @@ export const api = {
|
||||
() => ruleEngineService.getApprovalChain(),
|
||||
() => QUERY_KEYS.RULE_ENGINE.chain,
|
||||
),
|
||||
|
||||
reorder: endpoint<
|
||||
{ resource: RuleEngineResourceSlug; payload: { ids: string[]; requiresDirectorApproval?: boolean } },
|
||||
void
|
||||
>("rule-engine", "reorder", ({ resource, payload }) =>
|
||||
ruleEngineService.reorder(resource, payload),
|
||||
),
|
||||
|
||||
moveOrder: endpoint<
|
||||
{ resource: RuleEngineResourceSlug; id: string; direction: "up" | "down" },
|
||||
void
|
||||
>("rule-engine", "moveOrder", ({ resource, id, direction }) =>
|
||||
ruleEngineService.moveOrder(resource, id, direction),
|
||||
),
|
||||
},
|
||||
|
||||
bookings: {
|
||||
@@ -329,4 +345,12 @@ export const api = {
|
||||
({ id, reason }) => bookingsService.cancel(id, reason),
|
||||
),
|
||||
},
|
||||
|
||||
overview: {
|
||||
get: endpoint<{ range?: OverviewRange }, IOverviewDashboard>(
|
||||
"overview",
|
||||
"get",
|
||||
({ range }) => overviewService.getDashboard(range),
|
||||
),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -9,6 +9,8 @@ export interface BookingListFilter {
|
||||
status?: string;
|
||||
/** Comma-separated statuses for grouped tabs */
|
||||
statuses?: string;
|
||||
schedulingStatuses?: string;
|
||||
assignedToSchedule?: "true" | "false";
|
||||
/** Tab key for React Query cache (not sent to API) */
|
||||
tab?: string;
|
||||
// customerId?: string;
|
||||
@@ -121,6 +123,8 @@ export const bookingsService = {
|
||||
if (filter.pageSize != null) params.pageSize = filter.pageSize;
|
||||
if (filter.sortBy) params.sortBy = filter.sortBy;
|
||||
if (filter.sortOrder) params.sortOrder = filter.sortOrder;
|
||||
if (filter.schedulingStatuses) params.schedulingStatuses = filter.schedulingStatuses;
|
||||
if (filter.assignedToSchedule) params.assignedToSchedule = filter.assignedToSchedule;
|
||||
if (filter.companyId) params.companyId = filter.companyId;
|
||||
if (filter.freightType) params.freightType = filter.freightType;
|
||||
if (filter.tradeDirection) params.tradeDirection = filter.tradeDirection;
|
||||
@@ -210,6 +214,23 @@ export const bookingsService = {
|
||||
|
||||
cancel: (id: string, reason: string) =>
|
||||
postBooking<BookingDetail>(B.CANCEL(id), { reason }),
|
||||
|
||||
create: async (payload: Record<string, unknown>): Promise<BookingDetail> => {
|
||||
const response = await client.post<{ booking: BookingDetail } | BookingDetail>(
|
||||
B.BASE,
|
||||
payload,
|
||||
);
|
||||
const data = unwrap(response.data) as { booking?: BookingDetail };
|
||||
return (data.booking ?? data) as BookingDetail;
|
||||
},
|
||||
|
||||
getReferenceData: async () => {
|
||||
const response = await client.get(B.REFERENCE_DATA);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
governmentExpedite: (id: string) =>
|
||||
postBooking<BookingDetail>(B.GOVERNMENT_EXPEDITE(id)),
|
||||
};
|
||||
|
||||
async function ensurePdfBlob(blob: Blob): Promise<Blob> {
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
import { cargoService, type Cargo } from "@/services/cargoService";
|
||||
import { containerService, type Container } from "@/services/containerService";
|
||||
import { locomotivesService, type Locomotive } from "@/services/locomotives.service";
|
||||
import { trainService, type Train } from "@/services/trains.service";
|
||||
import { wagonService, type Wagon } from "@/services/wagon.service";
|
||||
import type { FleetResourceSlug } from "@/pages/fleet/config/resources";
|
||||
|
||||
export type FleetRecord = Locomotive | Train | Wagon | Container | Cargo;
|
||||
|
||||
const listHandlers: Record<FleetResourceSlug, () => Promise<FleetRecord[]>> = {
|
||||
locomotives: () => locomotivesService.getAll().then((r) => r.data),
|
||||
trains: () => trainService.getAll().then((r) => r.data),
|
||||
wagons: () => wagonService.getAll().then((r) => r.data),
|
||||
containers: () => containerService.getAll().then((r) => r.data),
|
||||
cargoes: () => cargoService.getAll().then((r) => r.data),
|
||||
};
|
||||
|
||||
const createHandlers: Record<FleetResourceSlug, (data: Record<string, unknown>) => Promise<unknown>> = {
|
||||
locomotives: (data) => locomotivesService.create(data),
|
||||
trains: (data) => trainService.create(data),
|
||||
wagons: (data) => wagonService.create(data),
|
||||
containers: (data) => containerService.create(data),
|
||||
cargoes: (data) => cargoService.create(data),
|
||||
};
|
||||
|
||||
const updateHandlers: Record<
|
||||
FleetResourceSlug,
|
||||
(id: string, data: Record<string, unknown>) => Promise<unknown>
|
||||
> = {
|
||||
locomotives: (id, data) => locomotivesService.update(id, data),
|
||||
trains: (id, data) => trainService.update(id, data),
|
||||
wagons: (id, data) => wagonService.update(id, data),
|
||||
containers: (id, data) => containerService.update(id, data),
|
||||
cargoes: (id, data) => cargoService.update(id, data),
|
||||
};
|
||||
|
||||
const removeHandlers: Record<FleetResourceSlug, (id: string) => Promise<unknown>> = {
|
||||
locomotives: (id) => locomotivesService.decommission(id),
|
||||
trains: (id) => trainService.delete(id),
|
||||
wagons: (id) => wagonService.delete(id),
|
||||
containers: (id) => containerService.delete(id),
|
||||
cargoes: (id) => cargoService.delete(id),
|
||||
};
|
||||
|
||||
export const fleetService = {
|
||||
list: (slug: FleetResourceSlug) => listHandlers[slug](),
|
||||
create: (slug: FleetResourceSlug, data: Record<string, unknown>) => createHandlers[slug](data),
|
||||
update: (slug: FleetResourceSlug, id: string, data: Record<string, unknown>) =>
|
||||
updateHandlers[slug](id, data),
|
||||
remove: (slug: FleetResourceSlug, id: string) => removeHandlers[slug](id),
|
||||
};
|
||||
@@ -0,0 +1,56 @@
|
||||
import { api as client } from "../auth/http";
|
||||
import { unwrap } from "@/utils/endpoint";
|
||||
import { URL_CONSTANTS } from "@/constants/URLS";
|
||||
import type {
|
||||
IOverviewBillingTab,
|
||||
IOverviewBookingsTab,
|
||||
IOverviewCustomersTab,
|
||||
IOverviewDashboard,
|
||||
IOverviewOperationsTab,
|
||||
IOverviewStaffTab,
|
||||
OverviewRange,
|
||||
} from "@/types/overview";
|
||||
|
||||
const O = URL_CONSTANTS.OVERVIEW;
|
||||
|
||||
export const overviewService = {
|
||||
getDashboard: async (range?: OverviewRange): Promise<IOverviewDashboard> => {
|
||||
const response = await client.get<IOverviewDashboard>(O.BASE, {
|
||||
params: range ? { range } : undefined,
|
||||
});
|
||||
return unwrap(response);
|
||||
},
|
||||
|
||||
getBookingsTab: async (range?: OverviewRange): Promise<IOverviewBookingsTab> => {
|
||||
const response = await client.get<IOverviewBookingsTab>(O.BOOKINGS, {
|
||||
params: range ? { range } : undefined,
|
||||
});
|
||||
return unwrap(response);
|
||||
},
|
||||
|
||||
getBillingTab: async (range?: OverviewRange): Promise<IOverviewBillingTab> => {
|
||||
const response = await client.get<IOverviewBillingTab>(O.BILLING, {
|
||||
params: range ? { range } : undefined,
|
||||
});
|
||||
return unwrap(response);
|
||||
},
|
||||
|
||||
getOperationsTab: async (): Promise<IOverviewOperationsTab> => {
|
||||
const response = await client.get<IOverviewOperationsTab>(O.OPERATIONS);
|
||||
return unwrap(response);
|
||||
},
|
||||
|
||||
getCustomersTab: async (range?: OverviewRange): Promise<IOverviewCustomersTab> => {
|
||||
const response = await client.get<IOverviewCustomersTab>(O.CUSTOMERS, {
|
||||
params: range ? { range } : undefined,
|
||||
});
|
||||
return unwrap(response);
|
||||
},
|
||||
|
||||
getStaffTab: async (range?: OverviewRange): Promise<IOverviewStaffTab> => {
|
||||
const response = await client.get<IOverviewStaffTab>(O.STAFF, {
|
||||
params: range ? { range } : undefined,
|
||||
});
|
||||
return unwrap(response);
|
||||
},
|
||||
};
|
||||
@@ -14,6 +14,14 @@ export interface RuleEngineListParams {
|
||||
pageSize?: number;
|
||||
isActive?: boolean;
|
||||
status?: string;
|
||||
sortBy?: string;
|
||||
sortOrder?: "ASC" | "DESC";
|
||||
requiresDirectorApproval?: boolean;
|
||||
}
|
||||
|
||||
export interface RuleEngineReorderPayload {
|
||||
ids: string[];
|
||||
requiresDirectorApproval?: boolean;
|
||||
}
|
||||
|
||||
const RESOURCE_BASE: Record<RuleEngineResourceSlug, string> = {
|
||||
@@ -59,25 +67,39 @@ const byIdPath = (resource: RuleEngineResourceSlug, id: string): string => {
|
||||
}
|
||||
};
|
||||
|
||||
const defaultMeta = (dataLength: number, page = 1, pageSize = 20): RuleEngineListMeta => ({
|
||||
const defaultMeta = (dataLength: number, page = 1, pageSize = 10): RuleEngineListMeta => ({
|
||||
total: dataLength,
|
||||
page,
|
||||
pageSize,
|
||||
totalPages: Math.max(1, Math.ceil(dataLength / pageSize)),
|
||||
});
|
||||
|
||||
const isPaginatedListResult = <T extends RuleEngineRecord>(
|
||||
value: unknown,
|
||||
): value is RuleEngineListResult<T> =>
|
||||
Boolean(value) &&
|
||||
typeof value === "object" &&
|
||||
"data" in value &&
|
||||
Array.isArray((value as RuleEngineListResult<T>).data);
|
||||
|
||||
const normalizeList = <T extends RuleEngineRecord>(
|
||||
payload: unknown,
|
||||
page = 1,
|
||||
pageSize = 20,
|
||||
pageSize = 10,
|
||||
): RuleEngineListResult<T> => {
|
||||
if (isPaginatedListResult<T>(payload)) {
|
||||
return {
|
||||
data: payload.data,
|
||||
meta: payload.meta ?? defaultMeta(payload.data.length, page, pageSize),
|
||||
};
|
||||
}
|
||||
|
||||
const body = unwrap(payload as { data: unknown }) as unknown;
|
||||
|
||||
if (body && typeof body === "object" && "data" in body && Array.isArray((body as RuleEngineListResult<T>).data)) {
|
||||
const typed = body as RuleEngineListResult<T>;
|
||||
if (isPaginatedListResult<T>(body)) {
|
||||
return {
|
||||
data: typed.data,
|
||||
meta: typed.meta ?? defaultMeta(typed.data.length, page, pageSize),
|
||||
data: body.data,
|
||||
meta: body.meta ?? defaultMeta(body.data.length, page, pageSize),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -98,7 +120,7 @@ export const ruleEngineService = {
|
||||
params?: RuleEngineListParams,
|
||||
): Promise<RuleEngineListResult<T>> => {
|
||||
const page = params?.page ?? 1;
|
||||
const pageSize = params?.pageSize ?? 20;
|
||||
const pageSize = params?.pageSize ?? 10;
|
||||
const response = await client.get(RESOURCE_BASE[resource], {
|
||||
params: {
|
||||
page,
|
||||
@@ -106,6 +128,9 @@ export const ruleEngineService = {
|
||||
search: params?.search,
|
||||
isActive: params?.isActive,
|
||||
status: params?.status,
|
||||
sortBy: params?.sortBy,
|
||||
sortOrder: params?.sortOrder,
|
||||
requiresDirectorApproval: params?.requiresDirectorApproval,
|
||||
},
|
||||
});
|
||||
return normalizeList<T>(response.data, page, pageSize);
|
||||
@@ -140,6 +165,21 @@ export const ruleEngineService = {
|
||||
await client.delete(byIdPath(resource, id));
|
||||
},
|
||||
|
||||
reorder: async (
|
||||
resource: RuleEngineResourceSlug,
|
||||
payload: RuleEngineReorderPayload,
|
||||
): Promise<void> => {
|
||||
await client.post(`${RESOURCE_BASE[resource]}/reorder`, payload);
|
||||
},
|
||||
|
||||
moveOrder: async (
|
||||
resource: RuleEngineResourceSlug,
|
||||
id: string,
|
||||
direction: "up" | "down",
|
||||
): Promise<void> => {
|
||||
await client.post(`${byIdPath(resource, id)}/move-order`, { direction });
|
||||
},
|
||||
|
||||
submitRate: async <T extends RuleEngineRecord>(id: string): Promise<T> => {
|
||||
const response = await client.post(URL_CONSTANTS.RULE_ENGINE.RATE_SUBMIT(id));
|
||||
return normalizeEntity<T>(response.data);
|
||||
|
||||
@@ -2,14 +2,18 @@ import { api as client } from '../auth/http';
|
||||
import { unwrap } from '@/utils/endpoint';
|
||||
import { URL_CONSTANTS } from '@/constants/URLS';
|
||||
import type {
|
||||
AssignBookingsPayload,
|
||||
CreateTrainSchedulePayload,
|
||||
EligibleContainerBookingsResponse,
|
||||
FreightType,
|
||||
LocomotiveRecord,
|
||||
PinWagonsPayload,
|
||||
TrainScheduleDetail,
|
||||
TrainScheduleFilters,
|
||||
TrainScheduleListItem,
|
||||
TrainSchedulePreviewPayload,
|
||||
TrainSchedulePreviewResponse,
|
||||
TrainSchedulingGlobalRules,
|
||||
YardOption,
|
||||
} from '@/types/trainScheduling';
|
||||
|
||||
@@ -17,22 +21,35 @@ interface BookingReferenceDataResponse {
|
||||
yard?: Array<YardOption & { label?: string }>;
|
||||
}
|
||||
|
||||
const pathsFor = (freightType?: FreightType) =>
|
||||
freightType === "BULK"
|
||||
? URL_CONSTANTS.TRAIN_SCHEDULING.BULK
|
||||
: URL_CONSTANTS.TRAIN_SCHEDULING.CONTAINER;
|
||||
|
||||
export const trainSchedulingService = {
|
||||
getEligibleBookings: async (
|
||||
filters?: TrainScheduleFilters,
|
||||
freightType?: FreightType,
|
||||
): Promise<EligibleContainerBookingsResponse> => {
|
||||
const useUnified = !freightType || freightType === "MIXED";
|
||||
// The container/bulk endpoints already encode freight type in the path, and their
|
||||
// query DTOs reject an extra `freightType` param — so only pass the station filters.
|
||||
const response = await client.get<EligibleContainerBookingsResponse>(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.ELIGIBLE_BOOKINGS,
|
||||
{ params: filters },
|
||||
useUnified
|
||||
? URL_CONSTANTS.TRAIN_SCHEDULING.ELIGIBLE_BOOKINGS
|
||||
: pathsFor(freightType).ELIGIBLE_BOOKINGS,
|
||||
{ params: { ...filters } },
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
preview: async (
|
||||
payload: TrainSchedulePreviewPayload,
|
||||
freightType?: FreightType,
|
||||
): Promise<TrainSchedulePreviewResponse> => {
|
||||
const useUnified = !freightType || freightType === "MIXED";
|
||||
const response = await client.post<TrainSchedulePreviewResponse>(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.PREVIEW,
|
||||
useUnified ? URL_CONSTANTS.TRAIN_SCHEDULING.PREVIEW : pathsFor(freightType).PREVIEW,
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
@@ -40,31 +57,92 @@ export const trainSchedulingService = {
|
||||
|
||||
createSchedule: async (
|
||||
payload: CreateTrainSchedulePayload,
|
||||
freightType?: FreightType,
|
||||
): Promise<TrainScheduleDetail> => {
|
||||
const response = await client.post<TrainScheduleDetail>(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.SCHEDULES,
|
||||
pathsFor(freightType).SCHEDULES,
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
listSchedules: async (): Promise<TrainScheduleListItem[]> => {
|
||||
listSchedules: async (
|
||||
freightType: FreightType = "CONTAINER",
|
||||
): Promise<TrainScheduleListItem[]> => {
|
||||
const response = await client.get<TrainScheduleListItem[]>(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.SCHEDULES,
|
||||
pathsFor(freightType === "MIXED" ? undefined : freightType).SCHEDULES,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
getScheduleById: async (id: string): Promise<TrainScheduleDetail> => {
|
||||
getScheduleById: async (
|
||||
id: string,
|
||||
freightType?: FreightType,
|
||||
): Promise<TrainScheduleDetail> => {
|
||||
const response = await client.get<TrainScheduleDetail>(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.SCHEDULE_BY_ID(id),
|
||||
pathsFor(freightType === "MIXED" ? undefined : freightType).SCHEDULE_BY_ID(id),
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
cancelSchedule: async (id: string): Promise<TrainScheduleDetail> => {
|
||||
assignBookings: async (
|
||||
scheduleId: string,
|
||||
payload: AssignBookingsPayload,
|
||||
freightType?: FreightType,
|
||||
): Promise<TrainScheduleDetail> => {
|
||||
const useUnified = !freightType || freightType === "MIXED";
|
||||
const response = await client.post<TrainScheduleDetail>(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.CANCEL_SCHEDULE(id),
|
||||
useUnified
|
||||
? URL_CONSTANTS.TRAIN_SCHEDULING.ASSIGN_BOOKINGS(scheduleId)
|
||||
: pathsFor(freightType).ASSIGN_BOOKINGS(scheduleId),
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
unassignBooking: async (
|
||||
scheduleId: string,
|
||||
bookingId: string,
|
||||
): Promise<TrainScheduleDetail> => {
|
||||
const response = await client.delete<TrainScheduleDetail>(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.UNASSIGN_BOOKING(scheduleId, bookingId),
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
pinWagons: async (
|
||||
scheduleId: string,
|
||||
payload: PinWagonsPayload,
|
||||
): Promise<TrainScheduleDetail> => {
|
||||
const response = await client.post<TrainScheduleDetail>(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.PIN_WAGONS(scheduleId),
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
finalizeSchedule: async (scheduleId: string): Promise<TrainScheduleDetail> => {
|
||||
const response = await client.post<TrainScheduleDetail>(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.FINALIZE(scheduleId),
|
||||
{},
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
dispatchSchedule: async (scheduleId: string): Promise<TrainScheduleDetail> => {
|
||||
const response = await client.post<TrainScheduleDetail>(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.DISPATCH(scheduleId),
|
||||
{},
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
cancelSchedule: async (
|
||||
id: string,
|
||||
freightType: FreightType = "CONTAINER",
|
||||
): Promise<TrainScheduleDetail> => {
|
||||
const response = await client.post<TrainScheduleDetail>(
|
||||
pathsFor(freightType === "MIXED" ? undefined : freightType).CANCEL_SCHEDULE(id),
|
||||
{},
|
||||
);
|
||||
return unwrap(response.data);
|
||||
@@ -85,6 +163,81 @@ export const trainSchedulingService = {
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
previewReschedule: async (
|
||||
scheduleId: string,
|
||||
payload: {
|
||||
incomingBookingIds: string[];
|
||||
trigger: string;
|
||||
reason?: string;
|
||||
newDepartureDate?: string;
|
||||
},
|
||||
) => {
|
||||
const response = await client.post(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.RESCHEDULE_PREVIEW(scheduleId),
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
executeReschedule: async (
|
||||
scheduleId: string,
|
||||
payload: {
|
||||
incomingBookingIds: string[];
|
||||
trigger: string;
|
||||
reason?: string;
|
||||
newDepartureDate?: string;
|
||||
finalBookingIds: string[];
|
||||
displacedBookingIds: string[];
|
||||
},
|
||||
) => {
|
||||
const response = await client.post(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.RESCHEDULE_EXECUTE(scheduleId),
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
maintenanceReschedule: async (
|
||||
scheduleId: string,
|
||||
payload: {
|
||||
incomingBookingIds: string[];
|
||||
newDepartureDate: string;
|
||||
reason?: string;
|
||||
},
|
||||
) => {
|
||||
const response = await client.post(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.MAINTENANCE(scheduleId),
|
||||
{ ...payload, trigger: "TRAIN_MAINTENANCE" },
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
getGlobalRules: async (): Promise<TrainSchedulingGlobalRules> => {
|
||||
const response = await client.get<TrainSchedulingGlobalRules>(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.GLOBAL_RULES,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
updateGlobalRules: async (
|
||||
payload: Partial<
|
||||
Pick<
|
||||
TrainSchedulingGlobalRules,
|
||||
| "maxTrainLengthMeters"
|
||||
| "maxTrainWeightTons"
|
||||
| "maxWagonsPerTrain"
|
||||
| "max20ftContainerWeightTons"
|
||||
| "max20ftPairWeightDiffTons"
|
||||
>
|
||||
>,
|
||||
): Promise<TrainSchedulingGlobalRules> => {
|
||||
const response = await client.patch<TrainSchedulingGlobalRules>(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.GLOBAL_RULES,
|
||||
payload,
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
getStations: async (): Promise<YardOption[]> => {
|
||||
const response = await client.get<BookingReferenceDataResponse>(
|
||||
URL_CONSTANTS.BOOKINGS.REFERENCE_DATA,
|
||||
|
||||
@@ -19,7 +19,11 @@ const asList = <T>(payload: ListResponse<T>): T[] =>
|
||||
export const wagonTypesService = {
|
||||
async getWagonTypes() {
|
||||
const response = await api.get<ListResponse<WagonType>>('/wagon-types', {
|
||||
<<<<<<< HEAD
|
||||
params: { isActive: 'all' },
|
||||
=======
|
||||
params: { isActive: 'all', pageSize: 500 },
|
||||
>>>>>>> 10b011de8feafce5c0bae21594df5b36596587db
|
||||
});
|
||||
return asList(response.data);
|
||||
},
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import type { Freight } from "@edr/types";
|
||||
|
||||
import { api as apiClient } from "../auth/http";
|
||||
|
||||
export interface Wagon {
|
||||
@@ -21,7 +23,8 @@ export interface Wagon {
|
||||
} | null;
|
||||
tareWeight: number;
|
||||
maxPayloadWeight: number;
|
||||
status: string;
|
||||
status: Freight.WagonStatus;
|
||||
readiness: Freight.WagonReadiness;
|
||||
notes?: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user