Merge pull request #1097 from Tria-plc/freight_feature/usermanagement

Freight feature/usermanagement
This commit is contained in:
marshal
2026-08-04 01:11:09 +03:00
committed by GitHub
48 changed files with 3687 additions and 181 deletions

View File

@@ -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],
),
},
};

View File

@@ -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);
},

View File

@@ -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);
},
};

View File

@@ -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,