fix(admin): allow manual container nodes without tracking

This commit is contained in:
2026-09-10 12:17:54 +08:00
parent e3b2552d8d
commit 20e4da5bb5
7 changed files with 75 additions and 85 deletions
@@ -0,0 +1,18 @@
import { http, unwrapApiResponse, type ApiEnvelope } from '@/shared/api/http'
import type { ContainerManualNodeRequest, ContainerShippingNodeDetail } from '../types'
const basePath = '/platform/v1/container-shipping-nodes'
function normalize(raw: ContainerShippingNodeDetail): ContainerShippingNodeDetail {
return { ...raw, containerBookingId: String(raw.containerBookingId), nodes: (raw.nodes || []).map((item) => ({ ...item, id: String(item.id), nodeSequence: Number(item.nodeSequence) })) }
}
export async function getContainerShippingNodes(containerBookingId: string): Promise<ContainerShippingNodeDetail> {
const response = await http.get<ApiEnvelope<ContainerShippingNodeDetail>, ApiEnvelope<ContainerShippingNodeDetail>>(`${basePath}/${encodeURIComponent(containerBookingId)}`)
return normalize(unwrapApiResponse(response))
}
export async function appendContainerShippingNode(containerBookingId: string, idempotencyKey: string, request: ContainerManualNodeRequest): Promise<ContainerShippingNodeDetail> {
const response = await http.post<ApiEnvelope<ContainerShippingNodeDetail>, ApiEnvelope<ContainerShippingNodeDetail>>(`${basePath}/${encodeURIComponent(containerBookingId)}`, request, { headers: { 'Idempotency-Key': idempotencyKey } })
return normalize(unwrapApiResponse(response))
}