Files
edr-platform/apps/edr-freight-web/backoffice/src/services/rates.service.ts

36 lines
965 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { api } from '../auth/http';
export interface Rate {
id: string;
rateType: string;
appliesTo: string;
trigger: string;
containerTypeId: string | null;
cargoTypeId: string | null;
tradeDirection: string | null;
currency: string;
rateValue: string;
rateUnit: string;
/** PER_LITER fuel rates only: price = baseLiters × rateValue, once per booking. */
baseLiters?: string | null;
status: string;
proposedByStaffId: string;
approvedByCeoId: string | null;
approvedAt: string | null;
createdAt: string;
updatedAt: string;
deletedAt: string | null;
}
export interface RatesListResponse {
data: Rate[];
meta: { total: number; page: number; pageSize: number; totalPages: number };
}
export const ratesService = {
list: (pageSize = 1000) =>
api.get<RatesListResponse>(`/rates?pageSize=${pageSize}`),
getByType: (rateType: string) =>
api.get<RatesListResponse>(`/rates?rateType=${rateType}&pageSize=1000`),
};