feat(appointment): complete customer receiving and trip continuation workflows

This commit is contained in:
2026-10-16 15:41:56 +08:00
parent 148085286d
commit 45f662ecf2
45 changed files with 2042 additions and 131 deletions
@@ -58,6 +58,7 @@ export type WorkCommandPayload =
| { command: 'ACCEPT_RETURN'; payload: { handoffVersion: number; note: string | null } }
export type WorkCommand = WorkCommandPayload & { expectedVersion: number; idempotencyKey: string }
export interface WorkCommandResult { item: WorkItem; affectedWorkItemKeys: string[] }
export interface BatchWorkResolution { batchKey: string; customerId: string | null; detail: WorkDetail | null; candidates: Array<{ customerId: string; workItemKey: string; batchNo: string | null }> }
const base = '/platform/v1/last-leg/appointment-work'
// Repeated types parameters are part of v1; Axios' default types[] syntax is not.
@@ -83,6 +84,9 @@ export async function getWorkItems(query: WorkItemsQuery, signal?: AbortSignal)
export async function getWorkDetail(key: string, signal?: AbortSignal) {
return unwrapApiResponse(await http.get<ApiEnvelope<WorkDetail>, ApiEnvelope<WorkDetail>>(`${base}/items/${encodeURIComponent(key)}`, { signal }))
}
export async function resolveBatchWork(batchKey: string, customerId?: string, signal?: AbortSignal) {
return unwrapApiResponse(await http.get<ApiEnvelope<BatchWorkResolution>, ApiEnvelope<BatchWorkResolution>>(`${base}/items/resolve`, { params: { batchKey, customerId }, signal }))
}
export async function submitWorkCommand(key: string, command: WorkCommand) {
return unwrapApiResponse(await http.post<ApiEnvelope<WorkCommandResult>, ApiEnvelope<WorkCommandResult>>(`${base}/items/${encodeURIComponent(key)}/commands`, command))
}