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.

wip: BoM routes

Brad Barbinf33839e915c2
diff --git a/apps/carbon/app/modules/sales/sales.models.ts b/apps/carbon/app/modules/sales/sales.models.ts
index 590a06245d..210a447083 100644
--- a/apps/carbon/app/modules/sales/sales.models.ts
+++ b/apps/carbon/app/modules/sales/sales.models.ts
@@ -168,10 +168,9 @@ export const quoteMaterialValidator = z
}),
}),
itemId: z.string().min(1, { message: "Item is required" }),
- itemReadableId: z.string().optional(),
+ itemReadableId: z.string().min(1, { message: "Item ID is required" }),
description: z.string().min(1, { message: "Description is required" }),
- methodOperationId: zfd.text(z.string().optional()),
- // description: z.string().min(1, { message: "Description is required" }),
+ quoteOperationId: zfd.text(z.string().optional()),
quantity: zfd.numeric(z.number().min(0)),
unitOfMeasureCode: z
.string()
diff --git a/apps/carbon/app/modules/sales/sales.service.ts b/apps/carbon/app/modules/sales/sales.service.ts
index f459971b76..f81e6bce52 100644
--- a/apps/carbon/app/modules/sales/sales.service.ts
+++ b/apps/carbon/app/modules/sales/sales.service.ts
@@ -648,6 +648,17 @@ export async function getQuoteMaterialsByLine(
.eq("quoteLineId", quoteLineId);
}
+export async function getQuoteMaterialsByMethodId(
+ client: SupabaseClient<Database>,
+ quoteMakeMethodId: string
+) {
+ return client
+ .from("quoteMaterial")
+ .select("*")
+ .eq("quoteMakeMethodId", quoteMakeMethodId)
+ .order("order", { ascending: true });
+}
+
export async function getQuoteMaterialsByOperation(
client: SupabaseClient<Database>,
quoteOperationId: string
@@ -1236,6 +1247,20 @@ export async function updateQuoteFavorite(
}
}
+export async function updateQuoteMaterialOrder(
+ client: SupabaseClient<Database>,
+ updates: {
+ id: string;
+ order: number;
+ updatedBy: string;
+ }[]
+) {
+ const updatePromises = updates.map(({ id, order, updatedBy }) =>
+ client.from("quoteMaterial").update({ order, updatedBy }).eq("id", id)
+ );
+ return Promise.all(updatePromises);
+}
+
export async function updateQuoteOperationOrder(
client: SupabaseClient<Database>,
updates: {
diff --git a/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx b/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
index 95017e4f65..f60ffef768 100644
--- a/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
@@ -113,6 +113,10 @@ const QuoteBillOfMaterial = ({
materials,
operations,
}: QuoteBillOfMaterialProps) => {
+ const { quoteId, lineId } = useParams();
+ if (!quoteId) throw new Error("quoteId not found");
+ if (!lineId) throw new Error("lineId not found");
+
const fetcher = useFetcher<{}>();
const [items, setItems] = useState<ItemWithData[]>(
@@ -163,7 +167,7 @@ const QuoteBillOfMaterial = ({
fetcher.submit(new FormData(), {
method: "post",
- action: path.to.deleteQuoteMaterial(item.id),
+ action: path.to.deleteQuoteMaterial(quoteId, lineId, item.id),
});
};
@@ -191,7 +195,7 @@ const QuoteBillOfMaterial = ({
formData.append("updates", JSON.stringify(updates));
fetcher.submit(formData, {
method: "post",
- action: path.to.quoteMaterialsOrder(quoteMakeMethodId),
+ action: path.to.quoteMaterialsOrder,
});
}, 1000);
@@ -323,7 +327,7 @@ const QuoteBillOfMaterial = ({
item={item}
setItems={setItems}
setSelectedItemId={setSelectedItemId}
- methodOperations={operations}
+ quoteOperations={operations}
/>
</motion.div>
</motion.div>
@@ -378,13 +382,17 @@ function MaterialForm({
item,
setItems,
setSelectedItemId,
- methodOperations,
+ quoteOperations,
}: {
item: ItemWithData;
setItems: Dispatch<SetStateAction<ItemWithData[]>>;
setSelectedItemId: Dispatch<SetStateAction<string | null>>;
- methodOperations: Operation[];
+ quoteOperations: Operation[];
}) {
+ const { quoteId, lineId } = useParams();
+ if (!quoteId) throw new Error("quoteId not found");
+ if (!lineId) throw new Error("lineId not found");
+
const { supabase } = useSupabase();
const methodMaterialFetcher = useFetcher<{ id: string }>();
const params = useParams();
@@ -475,8 +483,8 @@ function MaterialForm({
<ValidatedForm
action={
isTemporaryId(item.id)
- ? path.to.newQuoteMaterial(item.data.quoteMakeMethodId!)
- : path.to.quoteMaterial(item.data.quoteMakeMethodId, item.id!)
+ ? path.to.newQuoteMaterial(quoteId, lineId)
+ : path.to.quoteMaterial(quoteId, lineId, item.id!)
}
method="post"
defaultValues={item.data}
@@ -523,10 +531,10 @@ function MaterialForm({
}}
/>
<Select
- name="methodOperationId"
+ name="quoteOperationId"
label="Operation"
isClearable
- options={methodOperations.map((o) => ({
+ options={quoteOperations.map((o) => ({
value: o.id!,
label: o.description,
}))}
diff --git a/apps/carbon/app/modules/sales/ui/Quotes/QuoteBoMExplorer.tsx b/apps/carbon/app/modules/sales/ui/Quotes/QuoteBoMExplorer.tsx
index fc8f1aa2aa..5894cd166c 100644
--- a/apps/carbon/app/modules/sales/ui/Quotes/QuoteBoMExplorer.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotes/QuoteBoMExplorer.tsx
@@ -157,7 +157,7 @@ function NodeData({ node }: { node: FlatTreeItem<QuoteMethod> }) {
}
function getNodePath(node: FlatTreeItem<QuoteMethod>) {
- return node.data.isRoot
+ return node.data.methodType === "Make"
? path.to.quoteLineMethod(
node.data.quoteId,
node.data.quoteLineId,
@@ -166,8 +166,7 @@ function getNodePath(node: FlatTreeItem<QuoteMethod>) {
: path.to.quoteLineMaterial(
node.data.quoteId,
node.data.quoteLineId,
- node.data.quoteMaterialMakeMethodId ??
- node.data.methodType.toLowerCase(),
+ node.data.methodType.toLowerCase(),
node.data.methodMaterialId
);
}
diff --git a/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx b/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx
index 427671cd4d..dc1fcdc407 100644
--- a/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.details.tsx
@@ -64,7 +64,7 @@ export const loader = async ({ request, params }: LoaderFunctionArgs) => {
export async function action({ request, params }: ActionFunctionArgs) {
assertIsPost(request);
const { client, userId } = await requirePermissions(request, {
- create: "purchasing",
+ create: "sales",
});
const { quoteId, lineId } = params;
diff --git a/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.method.$methodId.tsx b/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.method.$methodId.tsx
index 4973144304..218203ba11 100644
--- a/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.method.$methodId.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$quoteId.$lineId.method.$methodId.tsx
@@ -2,6 +2,7 @@ import { VStack } from "@carbon/react";
import { json, redirect, useLoaderData, useParams } from "@remix-run/react";
import {
+ getQuoteMaterialsByMethodId,
getQuoteOperationsByMethodId,
QuoteBillOfMaterial,
QuoteBillOfProcess,
@@ -23,21 +24,39 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
if (!lineId) throw new Error("Could not find lineId");
if (!methodId) throw new Error("Could not find methodId");
- const [operations] = await Promise.all([
+ const [materials, operations] = await Promise.all([
+ getQuoteMaterialsByMethodId(client, methodId),
getQuoteOperationsByMethodId(client, methodId),
]);
+ if (materials.error) {
+ throw redirect(
+ path.to.quoteLine(quoteId, lineId),
+ await flash(
+ request,
+ error(materials.error, "Failed to load quote materials")
+ )
+ );
+ }
+
if (operations.error) {
throw redirect(
path.to.quoteLine(quoteId, lineId),
await flash(
request,
- error(operations.error, "Failed to load quote method")
+ error(operations.error, "Failed to load quote operations")
)
);
}
return json({
+ materials:
+ materials?.data.map((m) => ({
+ ...m,
+ itemType: m.itemType as "Part",
+ unitOfMeasureCode: m.unitOfMeasureCode ?? "",
+ quoteOperationId: m.quoteOperationId ?? undefined,
+ })) ?? [],
operations:
operations.data?.map((o) => ({
...o,
@@ -52,7 +71,7 @@ export default function QuoteMakeMethodRoute() {
const { methodId } = useParams();
if (!methodId) throw new Error("Could not find methodId");
- const { operations } = useLoaderData<typeof loader>();
+ const { materials, operations } = useLoaderData<typeof loader>();
return (
<VStack spacing={2} className="p-2">
@@ -64,7 +83,7 @@ export default function QuoteMakeMethodRoute() {
<QuoteBillOfMaterial
key={`bom:${methodId}`}
quoteMakeMethodId={methodId}
- materials={[]}
+ materials={materials}
operations={operations}
/>
</VStack>
diff --git a/apps/carbon/app/routes/x+/quote+/methods.$quoteId.$lineId.material.$id.tsx b/apps/carbon/app/routes/x+/quote+/methods.$quoteId.$lineId.material.$id.tsx
index 0ab7c8df5a..97d16ff0b6 100644
--- a/apps/carbon/app/routes/x+/quote+/methods.$quoteId.$lineId.material.$id.tsx
+++ b/apps/carbon/app/routes/x+/quote+/methods.$quoteId.$lineId.material.$id.tsx
@@ -1,6 +1,6 @@
import { validationError, validator } from "@carbon/remix-validated-form";
import { json, type ActionFunctionArgs } from "@remix-run/node";
-import { methodMaterialValidator, upsertMethodMaterial } from "~/modules/items";
+import { quoteMaterialValidator, upsertQuoteMaterial } from "~/modules/sales";
import { requirePermissions } from "~/services/auth/auth.server";
import { flash } from "~/services/session.server";
import { setCustomFields } from "~/utils/form";
@@ -10,57 +10,60 @@ import { error } from "~/utils/result";
export async function action({ request, params }: ActionFunctionArgs) {
assertIsPost(request);
const { client, companyId, userId } = await requirePermissions(request, {
- create: "parts",
+ create: "sales",
});
- const { makeMethodId, id } = params;
- if (!makeMethodId) {
- throw new Error("makeMethodId not found");
+ const { quoteId, lineId, id } = params;
+ if (!quoteId) {
+ throw new Error("quoteId not found");
+ }
+ if (!lineId) {
+ throw new Error("lineId not found");
}
if (!id) {
throw new Error("id not found");
}
const formData = await request.formData();
- const validation = await validator(methodMaterialValidator).validate(
- formData
- );
+ const validation = await validator(quoteMaterialValidator).validate(formData);
if (validation.error) {
return validationError(validation.error);
}
- const updateMethodMaterial = await upsertMethodMaterial(client, {
+ const updateQuoteMaterial = await upsertQuoteMaterial(client, {
+ quoteId,
+ quoteLineId: lineId,
...validation.data,
id: id,
companyId,
updatedBy: userId,
customFields: setCustomFields(formData),
});
- if (updateMethodMaterial.error) {
+ if (updateQuoteMaterial.error) {
return json(
{
id: null,
},
await flash(
request,
- error(updateMethodMaterial.error, "Failed to update method material")
+ error(updateQuoteMaterial.error, "Failed to update quote material")
)
);
}
- const methodMaterialId = updateMethodMaterial.data?.id;
- if (!methodMaterialId) {
+ const quoteMaterialId = updateQuoteMaterial.data?.id;
+ if (!quoteMaterialId) {
return json(
{
id: null,
},
await flash(
request,
- error(updateMethodMaterial, "Failed to update method material")
+ error(updateQuoteMaterial, "Failed to update quote material")
)
);
}
- return json({ id: methodMaterialId });
+ return json({ id: quoteMaterialId });
}
diff --git a/apps/carbon/app/routes/x+/quote+/methods.$quoteId.$lineId.material.delete.$id.tsx b/apps/carbon/app/routes/x+/quote+/methods.$quoteId.$lineId.material.delete.$id.tsx
index bfe8afe575..e728807371 100644
--- a/apps/carbon/app/routes/x+/quote+/methods.$quoteId.$lineId.material.delete.$id.tsx
+++ b/apps/carbon/app/routes/x+/quote+/methods.$quoteId.$lineId.material.delete.$id.tsx
@@ -1,5 +1,5 @@
import { json, type ActionFunctionArgs } from "@remix-run/node";
-import { deleteMethodMaterial } from "~/modules/items";
+import { deleteQuoteMaterial } from "~/modules/sales";
import { requirePermissions } from "~/services/auth/auth.server";
import { flash } from "~/services/session.server";
import { assertIsPost } from "~/utils/http";
@@ -8,18 +8,15 @@ import { error } from "~/utils/result";
export async function action({ request, params }: ActionFunctionArgs) {
assertIsPost(request);
const { client } = await requirePermissions(request, {
- delete: "parts",
+ delete: "sales",
});
- const { makeMethodId, id } = params;
- if (!makeMethodId) {
- throw new Error("makeMethodId not found");
- }
+ const { id } = params;
if (!id) {
throw new Error("id not found");
}
- const deleteMaterial = await deleteMethodMaterial(client, id);
+ const deleteMaterial = await deleteQuoteMaterial(client, id);
if (deleteMaterial.error) {
return json(
{
@@ -27,7 +24,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
},
await flash(
request,
- error(deleteMaterial.error, "Failed to delete method material")
+ error(deleteMaterial.error, "Failed to delete quote material")
)
);
}
diff --git a/apps/carbon/app/routes/x+/quote+/methods.$quoteId.$lineId.material.new.tsx b/apps/carbon/app/routes/x+/quote+/methods.$quoteId.$lineId.material.new.tsx
index 10cd21afad..d88d7c212d 100644
--- a/apps/carbon/app/routes/x+/quote+/methods.$quoteId.$lineId.material.new.tsx
+++ b/apps/carbon/app/routes/x+/quote+/methods.$quoteId.$lineId.material.new.tsx
@@ -10,7 +10,7 @@ import { error } from "~/utils/result";
export async function action({ request, params }: ActionFunctionArgs) {
assertIsPost(request);
const { client, companyId, userId } = await requirePermissions(request, {
- create: "parts",
+ create: "sales",
});
const { quoteId, lineId } = params;
@@ -45,23 +45,23 @@ export async function action({ request, params }: ActionFunctionArgs) {
},
await flash(
request,
- error(insertQuoteMaterial.error, "Failed to insert method material")
+ error(insertQuoteMaterial.error, "Failed to insert quote material")
)
);
}
- const methodMaterialId = insertQuoteMaterial.data?.id;
- if (!methodMaterialId) {
+ const quoteMaterialId = insertQuoteMaterial.data?.id;
+ if (!quoteMaterialId) {
return json(
{
id: null,
},
await flash(
request,
- error(insertQuoteMaterial, "Failed to insert method material")
+ error(insertQuoteMaterial, "Failed to insert quote material")
)
);
}
- return json({ id: methodMaterialId });
+ return json({ id: quoteMaterialId });
}
diff --git a/apps/carbon/app/routes/x+/quote+/methods.$quoteId.$lineId.operation.$id.tsx b/apps/carbon/app/routes/x+/quote+/methods.$quoteId.$lineId.operation.$id.tsx
index 0d02432342..3440e32ec7 100644
--- a/apps/carbon/app/routes/x+/quote+/methods.$quoteId.$lineId.operation.$id.tsx
+++ b/apps/carbon/app/routes/x+/quote+/methods.$quoteId.$lineId.operation.$id.tsx
@@ -10,7 +10,7 @@ import { error } from "~/utils/result";
export async function action({ request, params }: ActionFunctionArgs) {
assertIsPost(request);
const { client, companyId, userId } = await requirePermissions(request, {
- create: "parts",
+ create: "sales",
});
const { quoteId, lineId, id } = params;
diff --git a/apps/carbon/app/routes/x+/quote+/methods.$quoteId.$lineId.operation.new.tsx b/apps/carbon/app/routes/x+/quote+/methods.$quoteId.$lineId.operation.new.tsx
index 9ec5e4f28a..00fbfa67f4 100644
--- a/apps/carbon/app/routes/x+/quote+/methods.$quoteId.$lineId.operation.new.tsx
+++ b/apps/carbon/app/routes/x+/quote+/methods.$quoteId.$lineId.operation.new.tsx
@@ -10,7 +10,7 @@ import { error } from "~/utils/result";
export async function action({ request, params }: ActionFunctionArgs) {
assertIsPost(request);
const { client, companyId, userId } = await requirePermissions(request, {
- create: "parts",
+ create: "sales",
});
const { quoteId, lineId } = params;
diff --git a/apps/carbon/app/routes/x+/quote+/methods.material.order.tsx b/apps/carbon/app/routes/x+/quote+/methods.material.order.tsx
index 1e54220170..df6d493599 100644
--- a/apps/carbon/app/routes/x+/quote+/methods.material.order.tsx
+++ b/apps/carbon/app/routes/x+/quote+/methods.material.order.tsx
@@ -1,6 +1,6 @@
import { json, type ActionFunctionArgs } from "@remix-run/node";
-import { updateMaterialOrder } from "~/modules/items";
+import { updateQuoteMaterialOrder } from "~/modules/sales";
import { requirePermissions } from "~/services/auth/auth.server";
import { flash } from "~/services/session.server";
import { assertIsPost } from "~/utils/http";
@@ -9,7 +9,7 @@ import { error } from "~/utils/result";
export async function action({ request }: ActionFunctionArgs) {
assertIsPost(request);
const { client, userId } = await requirePermissions(request, {
- update: "parts",
+ update: "sales",
});
const updateMap = (await request.formData()).get("updates") as string;
@@ -28,7 +28,7 @@ export async function action({ request }: ActionFunctionArgs) {
})
);
- const updateSortOrders = await updateMaterialOrder(client, updates);
+ const updateSortOrders = await updateQuoteMaterialOrder(client, updates);
if (updateSortOrders.some((update) => update.error))
return json(
{},
diff --git a/apps/carbon/app/routes/x+/quote+/methods.operation.order.tsx b/apps/carbon/app/routes/x+/quote+/methods.operation.order.tsx
index e055119cc3..1383400f0c 100644
--- a/apps/carbon/app/routes/x+/quote+/methods.operation.order.tsx
+++ b/apps/carbon/app/routes/x+/quote+/methods.operation.order.tsx
@@ -9,7 +9,7 @@ import { error } from "~/utils/result";
export async function action({ request }: ActionFunctionArgs) {
assertIsPost(request);
const { client, userId } = await requirePermissions(request, {
- update: "parts",
+ update: "sales",
});
const updateMap = (await request.formData()).get("updates") as string;
diff --git a/apps/carbon/app/utils/path.ts b/apps/carbon/app/utils/path.ts
index 31ae753387..ff01bd0813 100644
--- a/apps/carbon/app/utils/path.ts
+++ b/apps/carbon/app/utils/path.ts
@@ -231,7 +231,7 @@ export const path = {
deletePurchaseOrderLine: (orderId: string, lineId: string) =>
generatePath(`${x}/purchase-order/${orderId}/lines/delete/${lineId}`),
deleteQuote: (id: string) => generatePath(`${x}/quote/delete/${id}`),
- deleteQuoteAssembly: (
+ deleteQuoteAssemblyDeprecated: (
quoteId: string,
lineId: string,
assemblyId: string
@@ -241,6 +241,10 @@ export const path = {
),
deleteQuoteLine: (id: string, lineId: string) =>
generatePath(`${x}/quote/${id}/${lineId}/delete`),
+ deleteQuoteMaterial: (quoteId: string, lineId: string, id: string) =>
+ generatePath(
+ `${x}/quote/methods/${quoteId}/${lineId}/material/delete/${id}`
+ ),
deleteReceipt: (id: string) => generatePath(`${x}/receipt/delete/${id}`),
deleteSalesOrder: (id: string) =>
generatePath(`${x}/sales-order/delete/${id}`),
@@ -450,10 +454,16 @@ export const path = {
generatePath(`${x}/quote/${id}/lines/${lineId}/new`),
newQuoteOperation: (quoteId: string, lineId: string) =>
generatePath(`${x}/quote/methods/${quoteId}/${lineId}/operation/new`),
- newQuoteMaterial: (quoteId: string, lineId: string, operationId: string) =>
+ newQuoteMaterialDeprecated: (
+ quoteId: string,
+ lineId: string,
+ operationId: string
+ ) =>
generatePath(
`${x}/quote/${quoteId}/lines/${lineId}/operation/${operationId}/material/new`
),
+ newQuoteMaterial: (quoteId: string, lineId: string) =>
+ generatePath(`${x}/quote/methods/${quoteId}/${lineId}/material/new`),
newReceipt: `${x}/receipt/new`,
newSalesOrder: `${x}/sales-order/new`,
newSalesOrderLine: (id: string) =>
@@ -566,7 +576,7 @@ export const path = {
generatePath(`${x}/quote/${id}/internal`),
quoteLine: (quoteId: string, id: string) =>
generatePath(`${x}/quote/${quoteId}/${id}/details`),
- quoteMaterial: (
+ quoteMaterialDeprecated: (
quoteId: string,
lineId: string,
operationId: string,
@@ -575,7 +585,7 @@ export const path = {
generatePath(
`${x}/quote/${quoteId}/lines/${lineId}/operation/${operationId}/material/${materialId}`
),
- quoteLineMaterial: (
+ quoteLineMaterialDeprecated: (
quoteId: string,
lineId: string,
makeMethodId: string,
@@ -584,8 +594,17 @@ export const path = {
generatePath(
`${x}/quote/${quoteId}/${lineId}/${makeMethodId}/${methodMaterialId}`
),
+ quoteLineMaterial: (
+ quoteId: string,
+ lineId: string,
+ methodType: string,
+ id: string
+ ) => generatePath(`${x}/quote/${quoteId}/${lineId}/${methodType}/${id}`),
quoteLineMethod: (quoteId: string, quoteLineId: string, methodId: string) =>
generatePath(`${x}/quote/${quoteId}/${quoteLineId}/method/${methodId}`),
+ quoteMaterial: (quoteId: string, lineId: string, id: string) =>
+ generatePath(`${x}/quote/methods/${quoteId}/${lineId}/${id}`),
+ quoteMaterialsOrder: `${x}/quote/methods/material/order`,
quoteOperation: (quoteId: string, lineId: string, id: string) =>
generatePath(`${x}/quote/methods/${quoteId}/${lineId}/operation/${id}`),
quoteOperationsOrder: `${x}/quote/methods/operation/order`,
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index f84169f2d4..a75729d553 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -13429,6 +13429,7 @@ export type Database = {
description: string
id: string
itemId: string
+ itemReadableId: string
itemType: string
methodType: Database["public"]["Enums"]["methodType"]
order: number
@@ -13450,6 +13451,7 @@ export type Database = {
description: string
id?: string
itemId: string
+ itemReadableId: string
itemType?: string
methodType?: Database["public"]["Enums"]["methodType"]
order?: number
@@ -13471,6 +13473,7 @@ export type Database = {
description?: string
id?: string
itemId?: string
+ itemReadableId?: string
itemType?: string
methodType?: Database["public"]["Enums"]["methodType"]
order?: number
@@ -23117,6 +23120,7 @@ export type Database = {
description: string | null
id: string | null
itemId: string | null
+ itemReadableId: string | null
itemType: string | null
methodType: Database["public"]["Enums"]["methodType"] | null
order: number | null
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index f84169f2d4..a75729d553 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -13429,6 +13429,7 @@ export type Database = {
description: string
id: string
itemId: string
+ itemReadableId: string
itemType: string
methodType: Database["public"]["Enums"]["methodType"]
order: number
@@ -13450,6 +13451,7 @@ export type Database = {
description: string
id?: string
itemId: string
+ itemReadableId: string
itemType?: string
methodType?: Database["public"]["Enums"]["methodType"]
order?: number
@@ -13471,6 +13473,7 @@ export type Database = {
description?: string
id?: string
itemId?: string
+ itemReadableId?: string
itemType?: string
methodType?: Database["public"]["Enums"]["methodType"]
order?: number
@@ -23117,6 +23120,7 @@ export type Database = {
description: string | null
id: string | null
itemId: string | null
+ itemReadableId: string | null
itemType: string | null
methodType: Database["public"]["Enums"]["methodType"] | null
order: number | null
diff --git a/packages/database/supabase/migrations/20240715024405_quotes.sql b/packages/database/supabase/migrations/20240715024405_quotes.sql
index 2cbf922838..ff5e70c04e 100644
--- a/packages/database/supabase/migrations/20240715024405_quotes.sql
+++ b/packages/database/supabase/migrations/20240715024405_quotes.sql
@@ -98,6 +98,7 @@ CREATE TABLE "quoteMaterial" (
"quoteId" TEXT NOT NULL,
"quoteLineId" TEXT NOT NULL,
"itemId" TEXT NOT NULL,
+ "itemReadableId" TEXT NOT NULL,
"itemType" TEXT NOT NULL DEFAULT 'Part',
"methodType" "methodType" NOT NULL DEFAULT 'Make',
"order" DOUBLE PRECISION NOT NULL DEFAULT 1,