From b545c6d064053d23ed21ff1afe4d25d119fe52fd Mon Sep 17 00:00:00 2001 From: Regalijan Date: Sun, 24 Mar 2024 02:29:50 -0400 Subject: [PATCH] Remove unused upload status endpoint --- functions/api/uploads/status.ts | 27 --------------------------- 1 file changed, 27 deletions(-) delete mode 100644 functions/api/uploads/status.ts diff --git a/functions/api/uploads/status.ts b/functions/api/uploads/status.ts deleted file mode 100644 index 134091f..0000000 --- a/functions/api/uploads/status.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { jsonError } from "../../common.js"; - -export async function onRequestPost(context: RequestContext) { - const { body } = context.data; - - if ( - !Array.isArray(body) || - body.find((attachment) => typeof attachment !== "string") - ) - return jsonError("Request body must be an array of strings", 400); - - if (body.length > 3) return jsonError("Too many video ids", 400); - - const kvPromises = []; - - for (const attachment of body) - kvPromises.push(context.env.DATA.get(`videoprocessing_${attachment}`)); - - const kvResults = await Promise.allSettled(kvPromises); - - if (kvResults.find((result) => result.status === "rejected")) - return jsonError("Failed to check status of attachments", 500); - - return new Response(null, { - status: kvResults.find((result) => result !== null) ? 409 : 204, - }); -}