feat(freight): Introduce booking reference data endpoint & schemas

This commit is contained in:
ghost2023
2026-06-01 15:44:23 +03:00
parent 973fc2cc85
commit ff3cbed747
3 changed files with 68 additions and 0 deletions

View File

@@ -137,6 +137,12 @@ export const api = {
bookingsService.create,
),
referenceData: endpoint<void, Freight.BookingReferenceData>(
"bookings",
"referenceData",
bookingsService.getReferenceData,
),
remove: endpoint<{ id: string }, void>("bookings", "remove", ({ id }) =>
bookingsService.remove(id),
),

View File

@@ -17,6 +17,10 @@ export const bookingsService = {
const { data } = await client.post("/api/bookings", payload);
return data.data;
},
getReferenceData: async (): Promise<Freight.BookingReferenceData> => {
const { data } = await client.get("/bookings/reference-data");
return data.data;
},
remove: async (id: string): Promise<void> => {
await client.delete(`/bookings/${id}`);
},

View File

@@ -216,6 +216,64 @@ export interface IInvoice extends BaseEntity {
dueAt: string;
}
// ── Reference Data (booking form catalog) ──────────────────────────────────────
export interface BookingReferenceYard {
id: string;
name: string;
code: string;
country: string;
}
export interface BookingReferenceContainerType {
id: string;
name: string;
code: string;
is_reefer: boolean;
wagons_per_unit: number;
}
export interface BookingReferenceContainerSizeGroup {
size: string;
types: BookingReferenceContainerType[];
}
export interface BookingReferenceService {
id: string;
name: string;
code: string;
}
export interface BookingReferenceShippingLine {
id: string;
name: string;
code: string;
}
export interface BookingReferenceCargoTypeChild {
id: string;
name: string;
code: string;
show_free_text_box: boolean;
}
export interface BookingReferenceCargoTypeGroup {
id: string;
name: string;
code: string;
children?: BookingReferenceCargoTypeChild[];
}
export interface BookingReferenceData {
yard: BookingReferenceYard[];
containers: BookingReferenceContainerSizeGroup[];
service: BookingReferenceService[];
shipping_line: BookingReferenceShippingLine[];
cargo_type: BookingReferenceCargoTypeGroup[];
}
// ── DTOs ───────────────────────────────────────────────────────────────────────
export interface CreateBookingDto {
reference: string;
customerId: string;