mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 23:28:11 +00:00
Merge pull request #1097 from Tria-plc/freight_feature/usermanagement
Freight feature/usermanagement
This commit is contained in:
@@ -163,6 +163,8 @@ import {
|
||||
type SaveLocomotivePayload,
|
||||
} from "./locomotives.service";
|
||||
import { overviewService } from "./overview.service";
|
||||
import { reportsService } from "./reports.service";
|
||||
import type { ReportQueryInput, ReportResult } from "@/types/reports";
|
||||
import {
|
||||
paymentsService,
|
||||
type PaginatedPayments,
|
||||
@@ -2880,4 +2882,13 @@ export const api = {
|
||||
({ range }) => overviewService.getDashboard(range),
|
||||
),
|
||||
},
|
||||
|
||||
reports: {
|
||||
run: endpoint<ReportQueryInput, ReportResult>(
|
||||
"reports",
|
||||
"run",
|
||||
(input) => reportsService.run(input),
|
||||
(input) => ["reports", input.key, input],
|
||||
),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -43,8 +43,12 @@ export const overviewService = {
|
||||
return unwrap(response);
|
||||
},
|
||||
|
||||
getOperationsTab: async (): Promise<IOverviewOperationsTab> => {
|
||||
const response = await client.get<IOverviewOperationsTab>(O.OPERATIONS);
|
||||
getOperationsTab: async (
|
||||
range?: OverviewRange,
|
||||
): Promise<IOverviewOperationsTab> => {
|
||||
const response = await client.get<IOverviewOperationsTab>(O.OPERATIONS, {
|
||||
params: range ? { range } : undefined,
|
||||
});
|
||||
return unwrap(response);
|
||||
},
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import { api as client } from "../auth/http";
|
||||
import { unwrap } from "@/utils/endpoint";
|
||||
import { URL_CONSTANTS } from "@/constants/URLS";
|
||||
import type { ReportQueryInput, ReportResult } from "@/types/reports";
|
||||
|
||||
export const reportsService = {
|
||||
run: async ({ key, ...params }: ReportQueryInput): Promise<ReportResult> => {
|
||||
const response = await client.get<ReportResult>(
|
||||
URL_CONSTANTS.REPORTS.RUN(key),
|
||||
{ params },
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
};
|
||||
@@ -3,6 +3,7 @@ import { api as client } from "../auth/http";
|
||||
import { unwrap } from "@/utils/endpoint";
|
||||
import { URL_CONSTANTS } from "@/constants/URLS";
|
||||
import type {
|
||||
AllocationCandidates,
|
||||
BatchBoardFilters,
|
||||
BatchBoardListResponse,
|
||||
BatchBoardScheduleDetail,
|
||||
@@ -319,6 +320,25 @@ export const trainSchedulingService = {
|
||||
);
|
||||
},
|
||||
|
||||
getAllocationCandidates: async (
|
||||
bookingId: string,
|
||||
): Promise<AllocationCandidates> => {
|
||||
const response = await client.get<AllocationCandidates>(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.ALLOCATION_CANDIDATES(bookingId),
|
||||
);
|
||||
return unwrap(response.data);
|
||||
},
|
||||
|
||||
allocatePaidBooking: async (
|
||||
bookingId: string,
|
||||
trainScheduleId: string,
|
||||
): Promise<void> => {
|
||||
await client.post(
|
||||
URL_CONSTANTS.TRAIN_SCHEDULING.ALLOCATE_BOOKING(bookingId),
|
||||
{ trainScheduleId },
|
||||
);
|
||||
},
|
||||
|
||||
getScheduleById: async (
|
||||
id: string,
|
||||
freightType?: FreightType,
|
||||
|
||||
Reference in New Issue
Block a user