fix(admin): render container documents as table
This commit is contained in:
@@ -5,6 +5,7 @@ import {
|
||||
confirmPreloadPlan,
|
||||
uploadLoadingDeclaration,
|
||||
completeLoadingDeclaration,
|
||||
downloadLoadingDeclaration,
|
||||
getPreloadPlan,
|
||||
listConfirmedLoadingLists,
|
||||
listPreloadPlans,
|
||||
@@ -174,4 +175,15 @@ describe('platform loading lists API', () => {
|
||||
expect(post.mock.calls[0]?.[2]).toMatchObject({ params: { warehouseId: '300' }, headers: { 'Content-Type': 'multipart/form-data', 'Idempotency-Key': expect.any(String) } })
|
||||
expect(post.mock.calls[1]?.[0]).toBe('/platform/v1/first-leg/loading-lists/100/customs/complete')
|
||||
})
|
||||
|
||||
it('downloads the current customs attachment through the exact loading-list endpoint with string ids', async () => {
|
||||
const blob = new Blob(['declaration'], { type: 'application/pdf' })
|
||||
const get = vi.spyOn(http, 'get').mockResolvedValue(blob)
|
||||
const result = await downloadLoadingDeclaration('2092438843630391401', '193000000000200002', '2092438843630391502')
|
||||
expect(get).toHaveBeenCalledWith(
|
||||
'/platform/v1/first-leg/loading-lists/2092438843630391401/customs/document/2092438843630391502/download',
|
||||
{ params: { warehouseId: '193000000000200002' }, responseType: 'blob' },
|
||||
)
|
||||
expect(result).toBe(blob)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -369,6 +369,13 @@ export async function uploadLoadingDeclaration(planId: string, warehouseId: stri
|
||||
return normalizeDocument(unwrapApiResponse(response))
|
||||
}
|
||||
|
||||
export async function downloadLoadingDeclaration(planId: string, warehouseId: string, fileId: string) {
|
||||
return http.get<Blob, Blob>(`${basePath}/loading-lists/${encodeURIComponent(planId)}/customs/document/${encodeURIComponent(fileId)}/download`, {
|
||||
params: { warehouseId },
|
||||
responseType: 'blob',
|
||||
})
|
||||
}
|
||||
|
||||
export async function completeLoadingDeclaration(planId: string, warehouseId: string, expectedVersion: number, operationReason?: string | null) {
|
||||
const response = await http.post<ApiEnvelope<BusinessDocument>, ApiEnvelope<BusinessDocument>>(`${basePath}/loading-lists/${encodeURIComponent(planId)}/customs/complete`, { expectedVersion, operationReason }, { params: { warehouseId }, headers: { 'Idempotency-Key': `loading-customs-complete-${planId}-${Date.now()}` } })
|
||||
return normalizeDocument(unwrapApiResponse(response))
|
||||
|
||||
Reference in New Issue
Block a user