feat(admin): add simulated container booking links
This commit is contained in:
@@ -13,6 +13,8 @@ import type {
|
||||
ContainerPage,
|
||||
ContainerQuery,
|
||||
ContainerSaveRequest,
|
||||
ContainerSimulationCreateRequest,
|
||||
ContainerOceanBookingLinkRequest,
|
||||
SmartLoadingCandidate,
|
||||
SmartLoadingItem,
|
||||
SmartLoadingPlan,
|
||||
@@ -68,6 +70,9 @@ function container(raw: ContainerBookingResource): ContainerBookingResource {
|
||||
id: id(raw.id),
|
||||
planId: optionalId(raw.planId),
|
||||
warehouseId: id(raw.warehouseId),
|
||||
oceanBookingId: optionalId(raw.oceanBookingId),
|
||||
oceanBookingRequirementId: optionalId(raw.oceanBookingRequirementId),
|
||||
customerId: optionalId(raw.customerId),
|
||||
shippingCompanyId: optionalId(raw.shippingCompanyId),
|
||||
version: numberValue(raw.version),
|
||||
capacityCbm: raw.capacityCbm == null ? null : numberValue(raw.capacityCbm),
|
||||
@@ -149,11 +154,21 @@ export function downloadContainerPdaPhoto(downloadPath: string) {
|
||||
return http.get<Blob, Blob>(downloadPath, { responseType: 'blob' })
|
||||
}
|
||||
|
||||
export async function createContainer(payload: ContainerSaveRequest) {
|
||||
export async function createContainerSimulation(payload: ContainerSimulationCreateRequest) {
|
||||
const response = await http.post<ApiEnvelope<ContainerBookingResource>, ApiEnvelope<ContainerBookingResource>>(containerPath, payload)
|
||||
return container(unwrapApiResponse(response))
|
||||
}
|
||||
|
||||
export async function linkContainerOceanBooking(containerId: string, payload: ContainerOceanBookingLinkRequest) {
|
||||
const response = await http.post<ApiEnvelope<ContainerBookingResource>, ApiEnvelope<ContainerBookingResource>>(`${containerPath}/${encodeURIComponent(containerId)}/ocean-booking-link`, payload)
|
||||
return container(unwrapApiResponse(response))
|
||||
}
|
||||
|
||||
export async function unlinkContainerOceanBooking(containerId: string, expectedVersion: number, reason: string) {
|
||||
const response = await http.delete<ApiEnvelope<ContainerBookingResource>, ApiEnvelope<ContainerBookingResource>>(`${containerPath}/${encodeURIComponent(containerId)}/ocean-booking-link`, { data: { expectedVersion, reason } })
|
||||
return container(unwrapApiResponse(response))
|
||||
}
|
||||
|
||||
export async function updateContainer(containerId: string, version: number, data: ContainerSaveRequest) {
|
||||
const response = await http.put<ApiEnvelope<ContainerBookingResource>, ApiEnvelope<ContainerBookingResource>>(`${containerPath}/${encodeURIComponent(containerId)}`, { version, data })
|
||||
return container(unwrapApiResponse(response))
|
||||
|
||||
Reference in New Issue
Block a user