Skip to content

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.

build: remove unused routes from supplier-quote

Brad Barbin7a6d66d1eb5a
diff --git a/apps/carbon/app/routes/x+/supplier-quote+/$id.$lineId.details.tsx b/apps/carbon/app/routes/x+/supplier-quote+/$id.$lineId.details.tsx
index 49e7bee245..9d33a09ae5 100644
--- a/apps/carbon/app/routes/x+/supplier-quote+/$id.$lineId.details.tsx
+++ b/apps/carbon/app/routes/x+/supplier-quote+/$id.$lineId.details.tsx
@@ -24,10 +24,6 @@ import type { MethodItemType } from "~/modules/shared";
import { setCustomFields } from "~/utils/form";
import { path } from "~/utils/path";
-export const config = {
- runtime: "nodejs",
-};
-
export const loader = async ({ request, params }: LoaderFunctionArgs) => {
const { companyId } = await requirePermissions(request, {
view: "purchasing",
diff --git a/apps/carbon/app/routes/x+/supplier-quote+/$id.status.tsx b/apps/carbon/app/routes/x+/supplier-quote+/$id.status.tsx
deleted file mode 100644
index 4d8a885803..0000000000
--- a/apps/carbon/app/routes/x+/supplier-quote+/$id.status.tsx
+++ /dev/null
@@ -1,50 +0,0 @@
-import { assertIsPost, error, success } from "@carbon/auth";
-import { requirePermissions } from "@carbon/auth/auth.server";
-import { flash } from "@carbon/auth/session.server";
-import type { ActionFunctionArgs } from "@vercel/remix";
-import { redirect } from "@vercel/remix";
-import {
- supplierQuoteStatusType,
- updateSupplierQuoteStatus,
-} from "~/modules/purchasing";
-import { path, requestReferrer } from "~/utils/path";
-
-export async function action({ request, params }: ActionFunctionArgs) {
- assertIsPost(request);
- const { client, userId } = await requirePermissions(request, {
- update: "purchasing",
- });
-
- const { id } = params;
- if (!id) throw new Error("Could not find id");
-
- const formData = await request.formData();
- const status = formData.get(
- "status"
- ) as (typeof supplierQuoteStatusType)[number];
-
- if (!status || !supplierQuoteStatusType.includes(status)) {
- throw redirect(
- path.to.supplierQuote(id),
- await flash(request, error(null, "Invalid status"))
- );
- }
-
- const update = await updateSupplierQuoteStatus(client, {
- id,
- status,
- assignee: ["Closed"].includes(status) ? null : undefined,
- updatedBy: userId,
- });
- if (update.error) {
- throw redirect(
- requestReferrer(request) ?? path.to.supplierQuote(id),
- await flash(request, error(update.error, "Failed to update quote status"))
- );
- }
-
- throw redirect(
- requestReferrer(request) ?? path.to.supplierQuote(id),
- await flash(request, success("Updated quote status"))
- );
-}
diff --git a/apps/carbon/app/routes/x+/supplier-quote+/$id.tsx b/apps/carbon/app/routes/x+/supplier-quote+/$id.tsx
index 3709c00684..a3b7cf999b 100644
--- a/apps/carbon/app/routes/x+/supplier-quote+/$id.tsx
+++ b/apps/carbon/app/routes/x+/supplier-quote+/$id.tsx
@@ -77,10 +77,6 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
});
}
-export const config = {
- runtime: "nodejs",
-};
-
export default function SupplierQuoteRoute() {
const params = useParams();
const { id } = params;
diff --git a/apps/carbon/app/routes/x+/supplier-quote+/$quoteId.convert.tsx b/apps/carbon/app/routes/x+/supplier-quote+/$quoteId.convert.tsx
deleted file mode 100644
index c846948074..0000000000
--- a/apps/carbon/app/routes/x+/supplier-quote+/$quoteId.convert.tsx
+++ /dev/null
@@ -1,73 +0,0 @@
-import {
- assertIsPost,
- error,
- getCarbonServiceRole,
- success,
-} from "@carbon/auth";
-import { requirePermissions } from "@carbon/auth/auth.server";
-import { flash } from "@carbon/auth/session.server";
-import { redirect, type ActionFunctionArgs } from "@vercel/remix";
-import { convertQuoteToOrder, selectedLinesValidator } from "~/modules/sales";
-import { path } from "~/utils/path";
-
-// the edge function grows larger than 2MB - so this is a workaround to avoid the edge function limit
-export const config = {
- runtime: "nodejs",
-};
-
-export async function action({ request, params }: ActionFunctionArgs) {
- assertIsPost(request);
- const { companyId, userId } = await requirePermissions(request, {
- create: "sales",
- });
-
- const { quoteId } = params;
- if (!quoteId) throw new Error("Could not find quoteId");
-
- const formData = await request.formData();
- const selectedLinesRaw = formData.get("selectedLines") ?? "{}";
-
- if (typeof selectedLinesRaw !== "string") {
- throw redirect(
- path.to.quoteDetails(quoteId),
- await flash(request, error("Invalid selected lines data"))
- );
- }
-
- const parseResult = selectedLinesValidator.safeParse(
- JSON.parse(selectedLinesRaw)
- );
-
- if (!parseResult.success) {
- console.error("Validation error:", parseResult.error);
- throw redirect(
- path.to.quoteDetails(quoteId),
- await flash(request, error("Invalid selected lines data"))
- );
- }
-
- const selectedLines = parseResult.data;
-
- const serviceRole = getCarbonServiceRole();
- const convert = await convertQuoteToOrder(serviceRole, {
- id: quoteId,
- companyId,
- userId,
- selectedLines,
- });
-
- if (convert.error) {
- throw redirect(
- path.to.quoteDetails(quoteId),
- await flash(
- request,
- error(convert.error, "Failed to convert quote to order")
- )
- );
- }
-
- throw redirect(
- path.to.salesOrder(convert.data?.convertedId!),
- await flash(request, success("Successfully converted quote to order"))
- );
-}