From ff67eed7b906684d94807668d9b61fe946ad7bc2 Mon Sep 17 00:00:00 2001 From: Ruge Li Date: Mon, 9 Feb 2026 15:34:15 -0800 Subject: [PATCH 1/4] remove unused collection constant --- src/constants/firebase.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/constants/firebase.ts b/src/constants/firebase.ts index 7f5bff4f..3fe68e76 100644 --- a/src/constants/firebase.ts +++ b/src/constants/firebase.ts @@ -7,7 +7,6 @@ export const FIREBASE_CONFIG = { //firestore collection names export const FIRESTORE_COLLECTIONS = { - RESULTS: "results", RECIPES: "recipes", CONFIGS: "configs", OBJECTS: "objects", From 539d80ab1dca438f6ce9220364463e96b2a954bb Mon Sep 17 00:00:00 2001 From: Ruge Li Date: Mon, 9 Feb 2026 15:44:47 -0800 Subject: [PATCH 2/4] refactor: remove get output dir, only use job_status --- src/utils/aws.ts | 7 +++---- src/utils/firebase.ts | 20 -------------------- 2 files changed, 3 insertions(+), 24 deletions(-) diff --git a/src/utils/aws.ts b/src/utils/aws.ts index 22839609..d6b3f961 100644 --- a/src/utils/aws.ts +++ b/src/utils/aws.ts @@ -1,5 +1,5 @@ import JSZip from "jszip"; -import { getOutputsDirectory } from "./firebase"; +import { getJobStatus } from "./firebase"; import { getS3ListUrl } from "../constants/aws"; @@ -80,9 +80,8 @@ export const downloadOutputsFromS3 = async (outputsDir: string, jobId: string) = export const downloadOutputs = async (jobId: string, outputsDir?: string) => { if (!outputsDir) { - // If uploading result files took too long, outputDir may not have been - // set when the job completed. Fetch it from Firestore. - outputsDir = await getOutputsDirectory(jobId); + const jobStatus = await getJobStatus(jobId); + outputsDir = jobStatus?.outputs_directory ?? ""; } await downloadOutputsFromS3(outputsDir, jobId); } diff --git a/src/utils/firebase.ts b/src/utils/firebase.ts index 5f8d25d4..cf2307a1 100644 --- a/src/utils/firebase.ts +++ b/src/utils/firebase.ts @@ -98,17 +98,6 @@ const mapQuerySnapshotToDocs = (querySnapshot: QuerySnapshot) => { })) as FirestoreDoc[]; }; -const extractSingleDocumentData = ( - querySnapshot: QuerySnapshot, - field?: string -) => { - let result = ""; - querySnapshot.forEach((doc) => { - result = field ? doc.data()[field] : doc.data(); - }); - return result; -}; - // Query functions for our use case using generic functions const getJobStatus = async ( jobId: string @@ -126,14 +115,6 @@ const getJobStatus = async ( return docs[0] || undefined; }; -const getOutputsDirectory = async (jobId: string) => { - const querySnapshot = await queryDocumentById( - FIRESTORE_COLLECTIONS.JOB_STATUS, - jobId - ); - return extractSingleDocumentData(querySnapshot, "outputs_directory"); -}; - const getAllDocsFromCollection = async (collectionName: string) => { const querySnapshot = await queryAllDocuments(collectionName); return mapQuerySnapshotToDocs(querySnapshot); @@ -283,5 +264,4 @@ export { docCleanup, getRecipeManifestFromFirebase, getRecipeDataFromFirebase, - getOutputsDirectory, }; From f72bb3fffdd9adadd9a506b9d99da42c498c1009 Mon Sep 17 00:00:00 2001 From: Ruge Li Date: Mon, 9 Feb 2026 15:49:23 -0800 Subject: [PATCH 3/4] remove unused fields --- src/constants/firebase.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/constants/firebase.ts b/src/constants/firebase.ts index 3fe68e76..bf8ed9b6 100644 --- a/src/constants/firebase.ts +++ b/src/constants/firebase.ts @@ -21,8 +21,6 @@ export const FIRESTORE_COLLECTIONS = { //firestore field names export const FIRESTORE_FIELDS = { NAME: "name", - BATCH_JOB_ID: "batch_job_id", - ORIGINAL_LOCATION: "original_location", RECIPE_PATH: "recipe_path", INHERIT: "inherit", COMPOSITION: "composition", From 4ffcd2c63b5c5e8c2edecdc343b3e1f30379fc83 Mon Sep 17 00:00:00 2001 From: Ruge Li Date: Tue, 10 Feb 2026 11:56:15 -0800 Subject: [PATCH 4/4] missed to remove unused constant --- src/types/index.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/types/index.ts b/src/types/index.ts index ea474830..25459634 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,6 +1,5 @@ export interface Document { name?: string; - original_location?: string; recipe_path?: string; recipe?: string; config?: string;