fix(admin): refresh container document versions
This commit is contained in:
@@ -3,7 +3,7 @@ import { http } from '@/shared/api/http'
|
||||
import {
|
||||
adjustSmartLoadingItem, assignSmartLoadingItem, createSmartLoadingPlan, getContainer,
|
||||
listContainers, listSmartLoadingCandidates, pushSmartLoadingPreload, removeSmartLoadingItem,
|
||||
getContainerClearance, uploadContainerClearance, completeContainerClearance,
|
||||
getContainerClearance, downloadContainerClearance, uploadContainerClearance, completeContainerClearance,
|
||||
getContainerOverview, markContainerException, cancelContainerException, uploadContainerDocument, downloadContainerDocument, downloadContainerPdaPhoto,
|
||||
getCustomerContainerTransitSummary,
|
||||
createContainerSimulation, linkContainerOceanBooking, unlinkContainerOceanBooking,
|
||||
@@ -150,4 +150,12 @@ describe('platform container loading API', () => {
|
||||
'/platform/v1/containers/7/pda/photos/../23/download', '/api/api/platform/v1/containers/7/pda/photos/23/download',
|
||||
]) expect(() => downloadContainerPdaPhoto(path)).toThrow('invalid container photo path')
|
||||
})
|
||||
|
||||
it('downloads destination clearance through its exact protected endpoint with string ids', async () => {
|
||||
const blob = new Blob(['clearance'])
|
||||
vi.mocked(http.get).mockResolvedValueOnce(blob)
|
||||
const result = await downloadContainerClearance('2092438843630391297', '2092438843630393502')
|
||||
expect(http.get).toHaveBeenCalledWith('/platform/v1/containers/2092438843630391297/clearance/document/2092438843630393502/download', { responseType: 'blob' })
|
||||
expect(result).toBe(blob)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -206,6 +206,10 @@ export async function getContainerClearance(containerId: string) {
|
||||
return document(unwrapApiResponse(response))
|
||||
}
|
||||
|
||||
export function downloadContainerClearance(containerId: string, fileId: string) {
|
||||
return http.get<Blob, Blob>(`${containerPath}/${encodeURIComponent(containerId)}/clearance/document/${encodeURIComponent(fileId)}/download`, { responseType: 'blob' })
|
||||
}
|
||||
|
||||
export async function uploadContainerClearance(containerId: string, file: File, expectedVersion: number, operationReason?: string | null) {
|
||||
const body = new FormData()
|
||||
body.append('file', file)
|
||||
|
||||
Reference in New Issue
Block a user