refactor(intake): extract upload storage helper

This commit is contained in:
WuYongJie 2026-06-08 20:20:25 +08:00
parent 14d7ddcd4e
commit 03ac72700b
2 changed files with 15 additions and 15 deletions

View File

@ -536,6 +536,7 @@ import {
} from "./previewHoleHelpers";
import { inferUploadCategory } from "./uploadCategoryHelpers";
import { productHasLocalAssets } from "./localAssetHelpers";
import { shouldUseRemoteAssetStorage } from "./uploadStorageHelpers";
import {
buildFinishedSampleShipmentRows,
buildSampleMeasurementRows,
@ -4556,21 +4557,6 @@ function createInitialDocumentWorkspaceApprovedAt(
return approvedAt;
}
type NonIntegratedRemoteAssetStorageTestGlobal = typeof globalThis & {
__NON_INTEGRATED_REMOTE_ASSET_STORAGE_TEST_OVERRIDE__?: boolean;
};
function shouldUseRemoteAssetStorage() {
if (process.env.NODE_ENV === "test") {
return (
(globalThis as NonIntegratedRemoteAssetStorageTestGlobal)
.__NON_INTEGRATED_REMOTE_ASSET_STORAGE_TEST_OVERRIDE__ === true
);
}
return true;
}
const NON_INTEGRATED_IMAGE_UPLOAD_MAX_DIMENSION = 2048;
function nonIntegratedImageUploadFileName(file: File) {

View File

@ -0,0 +1,14 @@
type NonIntegratedRemoteAssetStorageTestGlobal = typeof globalThis & {
__NON_INTEGRATED_REMOTE_ASSET_STORAGE_TEST_OVERRIDE__?: boolean;
};
export function shouldUseRemoteAssetStorage() {
if (process.env.NODE_ENV === "test") {
return (
(globalThis as NonIntegratedRemoteAssetStorageTestGlobal)
.__NON_INTEGRATED_REMOTE_ASSET_STORAGE_TEST_OVERRIDE__ === true
);
}
return true;
}