优化
This commit is contained in:
@@ -112,10 +112,10 @@ describe('platform container loading API', () => {
|
||||
container: { id: 9007199254740993, warehouseId: 9007199254740994, version: '4' }, loadingPlanId: 9007199254740995,
|
||||
pda: { taskId: 9007199254740996, loadingPlanId: 9007199254740995, containerBookingId: 9007199254740993, taskVersion: '2', itemCount: '4', completedItemCount: '3', unresolvedItemCount: '1', photoCounts: [{ evidenceType: 'EMPTY_CONTAINER', count: '2' }], photos: [{ evidenceId: 20, tenantId: 21, inboundId: 22, fileId: 23, downloadPath: '/api/platform/v1/containers/9007199254740993/pda/photos/23/download' }], exceptionReasons: [] },
|
||||
documents: [{ id: 9007199254740997, documentType: 'DELIVERY_ORDER', fileId: 9007199254740998, uploadedBy: 9, version: '2' }],
|
||||
exception: { active: false, markedBy: null }, exceptionHistory: [{ id: 10, operatorId: 11 }], timeline: [{ operatorId: 12 }],
|
||||
exception: { active: false, markedBy: null }, exceptionHistory: [{ id: 10, operatorId: 11 }], timeline: [{ id: '2092438843630397001', eventId: '2092438843630397002', idempotencyKey: '2092438843630397003', operatorId: 12, eventType: 'PUSH_PRELOAD', detail: '推送预装清单' }],
|
||||
} })
|
||||
const result = await getContainerOverview('7')
|
||||
expect(result).toMatchObject({ container: { id: expect.any(String), warehouseId: expect.any(String), version: 4 }, loadingPlanId: expect.any(String), pda: { taskId: expect.any(String), itemCount: 4, photoCounts: [{ count: 2 }] }, documents: [{ fileId: expect.any(String), version: 2 }] })
|
||||
expect(result).toMatchObject({ container: { id: expect.any(String), warehouseId: expect.any(String), version: 4 }, loadingPlanId: expect.any(String), pda: { taskId: expect.any(String), itemCount: 4, photoCounts: [{ count: 2 }] }, documents: [{ fileId: expect.any(String), version: 2 }], timeline: [{ id: '2092438843630397001', eventId: '2092438843630397002', idempotencyKey: '2092438843630397003', operatorId: '12' }] })
|
||||
expect(http.get).toHaveBeenCalledWith('/platform/v1/containers/7/overview')
|
||||
|
||||
vi.mocked(http.post).mockResolvedValueOnce({ code: '200', data: null })
|
||||
|
||||
@@ -60,7 +60,13 @@ function overview(raw: ContainerOverview): ContainerOverview {
|
||||
documents: (raw.documents || []).map(overviewDocument),
|
||||
exception: { ...raw.exception, markedBy: optionalId(raw.exception?.markedBy) },
|
||||
exceptionHistory: (raw.exceptionHistory || []).map((entry) => ({ ...entry, id: id(entry.id), operatorId: optionalId(entry.operatorId) })),
|
||||
timeline: (raw.timeline || []).map((entry) => ({ ...entry, operatorId: optionalId(entry.operatorId) })),
|
||||
timeline: (raw.timeline || []).map((entry) => ({
|
||||
...entry,
|
||||
id: optionalId(entry.id),
|
||||
eventId: optionalId(entry.eventId),
|
||||
idempotencyKey: optionalId(entry.idempotencyKey),
|
||||
operatorId: optionalId(entry.operatorId),
|
||||
})),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user