Files
edr-platform/apps/edr-freight-web/portal/src/services/bookings.service.ts
Michael Abebe 1c5ee19388 chore: fmt
2026-05-12 16:50:18 +03:00

30 lines
835 B
TypeScript

import type { Freight, PaginatedResponse } from "@edr/types";
import { api } from "../utils/api";
export interface CreateBookingPayload {
reference: string;
customerId: string;
scheduledDate: string;
totalAmount: number;
trainId?: string;
}
export const bookingsService = {
list: async (): Promise<PaginatedResponse<Freight.IBooking>> => {
const { data } = await api.get("/bookings");
return data.data;
},
get: async (id: string): Promise<Freight.IBooking> => {
const { data } = await api.get(`/bookings/${id}`);
return data.data;
},
create: async (payload: CreateBookingPayload): Promise<Freight.IBooking> => {
const { data } = await api.post("/bookings", payload);
return data.data;
},
remove: async (id: string): Promise<void> => {
await api.delete(`/bookings/${id}`);
},
};