Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
fix: move the file before passing the new path to the autodesk job
Brad Barbin12164331b3f0
diff --git a/apps/carbon/app/routes/x+/sales-rfq+/$rfqId.drag.tsx b/apps/carbon/app/routes/x+/sales-rfq+/$rfqId.drag.tsxindex d827dd2b43..818af0a5cb 100644--- a/apps/carbon/app/routes/x+/sales-rfq+/$rfqId.drag.tsx+++ b/apps/carbon/app/routes/x+/sales-rfq+/$rfqId.drag.tsx@@ -40,7 +40,7 @@ export async function action({ request, params }: ActionFunctionArgs) {} = validation.data;let targetLineId = lineId;- console.log({ targetLineId });+if (!targetLineId) {// we are creating a new linelet data = {@@ -74,16 +74,14 @@ export async function action({ request, params }: ActionFunctionArgs) {);}}- console.log("targetLineId2", { targetLineId });+const fileName = documentPath.split("/").pop();let newPath = "";if (is3DModel) {- console.log("is3DModel");const fileId = nanoid();const fileExtension = fileName?.split(".").pop();newPath = `${companyId}/models/${fileId}.${fileExtension}`;- console.log("updating models");const [recordUpdate, recordCreate] = await Promise.all([client.from("salesRfqLine")@@ -96,7 +94,7 @@ export async function action({ request, params }: ActionFunctionArgs) {createdBy: userId,}),]);- console.log("model update complete");+if (recordUpdate.error) {throw redirect(path.to.salesRfqDetails(rfqId),@@ -117,7 +115,17 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- console.log("sending autodesk event");+ // Move the file to the new path+ const move = await client.storage+ .from("private")+ .move(documentPath, newPath);++ if (move.error) {+ throw redirect(+ path.to.salesRfqDetails(rfqId),+ await flash(request, error(move.error, "Failed to move file"))+ );+ }await triggerClient.sendEvent({name: "autodesk.upload",payload: {@@ -133,17 +141,17 @@ export async function action({ request, params }: ActionFunctionArgs) {});} else {newPath = `${companyId}/opportunity-line/${targetLineId}/${fileName}`;- }+ // Move the file to the new path+ const move = await client.storage+ .from("private")+ .move(documentPath, newPath);- console.log("moving to", { newPath });- // Move the file to the new path- const move = await client.storage.from("private").move(documentPath, newPath);-- if (move.error) {- throw redirect(- path.to.salesRfqDetails(rfqId),- await flash(request, error(move.error, "Failed to move file"))- );+ if (move.error) {+ throw redirect(+ path.to.salesRfqDetails(rfqId),+ await flash(request, error(move.error, "Failed to move file"))+ );+ }}throw redirect(path.to.salesRfqDetails(rfqId));