feat(bookings): Integrate booking list and detail pages with backend API

This commit is contained in:
ghost2023
2026-06-02 16:04:47 +03:00
parent 34bf4ade48
commit dab72217e1
6 changed files with 189 additions and 20 deletions

View File

@@ -27,6 +27,8 @@ import {
ruleEngineService,
RuleEngineListParams,
} from "./ruleEngine/ruleEngine.service";
import { bookingsService, BookingListFilter } from "./bookings.service";
import type { Freight, PaginatedResponse } from "@edr/types";
export const api = {
fileUploadSettings: {
@@ -220,4 +222,30 @@ export const api = {
() => ruleEngineService.getApprovalChain(),
),
},
bookings: {
list: endpoint<
{ filter?: BookingListFilter },
PaginatedResponse<Freight.IBooking>
>("bookings", "list", ({ filter }) => bookingsService.list(filter)),
getById: endpoint<{ id: string }, Freight.IBooking>(
"bookings",
"getById",
({ id }) => bookingsService.getById(id),
),
updateStatus: endpoint<
{ id: string; action: string; reason?: string },
Freight.IBooking
>("bookings", "updateStatus", ({ id, action, reason }) =>
bookingsService.updateStatus(id, { action, reason }),
),
remove: endpoint<{ id: string }, void>(
"bookings",
"remove",
({ id }) => bookingsService.remove(id),
),
},
};