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.

refactor: fix types in carbon

Brad Barbinfac5d74e485f
diff --git a/apps/carbon/app/modules/sales/sales.models.ts b/apps/carbon/app/modules/sales/sales.models.ts
index 528826e11b..968494b970 100644
--- a/apps/carbon/app/modules/sales/sales.models.ts
+++ b/apps/carbon/app/modules/sales/sales.models.ts
@@ -87,6 +87,7 @@ export const quotationAssemblyValidator = z.object({
id: zfd.text(z.string().optional()),
parentAssemblyId: zfd.text(z.string().optional()),
itemId: z.string().min(1, { message: "Part is required" }),
+ itemReadableId: zfd.text(z.string().optional()),
description: z.string().min(1, { message: "Description is required" }),
unitOfMeasureCode: zfd.text(z.string().optional()),
quantityPerParent: zfd.numeric(
@@ -97,6 +98,7 @@ export const quotationAssemblyValidator = z.object({
export const quotationMaterialValidator = z.object({
id: zfd.text(z.string().optional()),
itemId: z.string().min(1, { message: "Part is required" }),
+ itemReadableId: zfd.text(z.string().optional()),
quantity: zfd.numeric(
z.number().min(0.00001, { message: "Quantity is required" })
),
@@ -136,6 +138,7 @@ export const quotationLineValidator = z.object({
id: zfd.text(z.string().optional()),
quoteId: z.string(),
itemId: z.string().min(1, { message: "Part is required" }),
+ itemReadableId: zfd.text(z.string().optional()),
status: z.enum(quoteLineStatusType, {
errorMap: () => ({ message: "Status is required" }),
}),
@@ -170,6 +173,8 @@ export const salesOrderLineType = [
"Hardware",
"Consumable",
"Comment",
+ "GL Account",
+ "Fixed Asset",
] as const;
export const salesOrderStatusType = [
diff --git a/apps/carbon/app/modules/sales/ui/Quotation/QuotationLineForm.tsx b/apps/carbon/app/modules/sales/ui/Quotation/QuotationLineForm.tsx
index b1c72f6077..c6497cf583 100644
--- a/apps/carbon/app/modules/sales/ui/Quotation/QuotationLineForm.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotation/QuotationLineForm.tsx
@@ -68,22 +68,28 @@ const QuotationLineForm = ({ initialValues }: QuotationLineFormProps) => {
? !permissions.can("update", "sales")
: !permissions.can("create", "sales");
- const [partData, setPartData] = useState<{
+ const [itemData, setItemData] = useState<{
itemId: string;
+ itemReadableId: string;
description: string;
replenishmentSystem: string;
uom: string;
}>({
itemId: initialValues.itemId ?? "",
+ itemReadableId: initialValues.itemReadableId ?? "",
description: initialValues.description ?? "",
replenishmentSystem: initialValues.replenishmentSystem ?? "",
uom: initialValues.unitOfMeasureCode ?? "",
});
- const onPartChange = async (itemId: string) => {
+ const onItemChange = async (itemId: string) => {
if (!supabase || !company.id) return;
const [item, part] = await Promise.all([
- supabase.from("item").select("name").eq("id", itemId).single(),
+ supabase
+ .from("item")
+ .select("name, readableId")
+ .eq("id", itemId)
+ .single(),
supabase
.from("part")
.select("replenishmentSystem, unitOfMeasureCode")
@@ -92,8 +98,9 @@ const QuotationLineForm = ({ initialValues }: QuotationLineFormProps) => {
.single(),
]);
- setPartData({
+ setItemData({
itemId,
+ itemReadableId: item.data?.readableId ?? "",
description: item.data?.name ?? "",
replenishmentSystem:
part.data?.replenishmentSystem === "Buy and Make"
@@ -121,7 +128,7 @@ const QuotationLineForm = ({ initialValues }: QuotationLineFormProps) => {
<CardTitle>{isEditing ? "Quote Line" : "New Quote Line"}</CardTitle>
<CardDescription>
{isEditing
- ? partData?.description
+ ? itemData?.description
: "A quote line contains pricing and lead times for a particular part"}
</CardDescription>
</CardHeader>
@@ -157,7 +164,8 @@ const QuotationLineForm = ({ initialValues }: QuotationLineFormProps) => {
<Hidden name="intent" value="line" />
<Hidden name="id" />
<Hidden name="quoteId" />
- <Hidden name="unitOfMeasureCode" value={partData?.uom} />
+ <Hidden name="itemReadableId" value={itemData?.itemReadableId} />
+ <Hidden name="unitOfMeasureCode" value={itemData?.uom} />
<VStack>
<div className="grid w-full gap-x-8 gap-y-2 grid-cols-1 lg:grid-cols-3">
<Item
@@ -165,16 +173,16 @@ const QuotationLineForm = ({ initialValues }: QuotationLineFormProps) => {
type="Part"
label="Part"
onChange={(value) => {
- onPartChange(value?.value as string);
+ onItemChange(value?.value as string);
}}
/>
<InputControlled
name="description"
label="Description"
- value={partData.description}
+ value={itemData.description}
onChange={(newValue) =>
- setPartData((d) => ({ ...d, description: newValue }))
+ setItemData((d) => ({ ...d, description: newValue }))
}
/>
@@ -182,9 +190,9 @@ const QuotationLineForm = ({ initialValues }: QuotationLineFormProps) => {
name="replenishmentSystem"
label="Replenishment System"
options={
- partData.replenishmentSystem === "Buy"
+ itemData.replenishmentSystem === "Buy"
? [{ label: "Buy", value: "Buy" }]
- : partData.replenishmentSystem === "Make"
+ : itemData.replenishmentSystem === "Make"
? [{ label: "Make", value: "Make" }]
: [
{
@@ -197,10 +205,10 @@ const QuotationLineForm = ({ initialValues }: QuotationLineFormProps) => {
},
]
}
- value={partData.replenishmentSystem}
+ value={itemData.replenishmentSystem}
onChange={(newValue) => {
if (newValue)
- setPartData((d) => ({
+ setItemData((d) => ({
...d,
replenishmentSystem: newValue?.value,
}));
diff --git a/apps/carbon/app/modules/sales/ui/Quotation/useQuotation.tsx b/apps/carbon/app/modules/sales/ui/Quotation/useQuotation.tsx
index d01ea4aeee..4cf2db2199 100644
--- a/apps/carbon/app/modules/sales/ui/Quotation/useQuotation.tsx
+++ b/apps/carbon/app/modules/sales/ui/Quotation/useQuotation.tsx
@@ -69,6 +69,7 @@ const $quotationLinePriceEffects = computed($quotationStore, (store) => {
const linePriceEffects = store?.lines
?.filter((line) => line.replenishmentSystem === "Make")
.reduce<Record<string, LinePriceEffects>>((effects, line) => {
+ if (!line.id) return effects;
effects[line.id] = {
materialCost: [],
laborCost: [],
@@ -118,23 +119,23 @@ const $quotationLinePriceEffects = computed($quotationStore, (store) => {
0
);
- effects[line.id].materialCost.push((quantity) => {
+ effects[line.id!].materialCost.push((quantity) => {
return materialCost * quantity * extendedQuantityPerAssembly;
});
if (operation.setupHours) {
- effects[line.id].setupHours.push((_quantity) => {
+ effects[line.id!].setupHours.push((_quantity) => {
return operation.setupHours;
});
if (operation.quotingRate) {
- effects[line.id].overheadCost.push((_quantity) => {
+ effects[line.id!].overheadCost.push((_quantity) => {
return operation.setupHours * (operation.quotingRate ?? 0);
});
} else {
- effects[line.id].laborCost.push((_quantity) => {
+ effects[line.id!].laborCost.push((_quantity) => {
return operation.setupHours * (operation.laborRate ?? 0);
});
- effects[line.id].overheadCost.push((_quantity) => {
+ effects[line.id!].overheadCost.push((_quantity) => {
return operation.setupHours * (operation.overheadRate ?? 0);
});
}
@@ -179,7 +180,7 @@ const $quotationLinePriceEffects = computed($quotationStore, (store) => {
break;
}
- effects[line.id].productionHours.push((quantity) => {
+ effects[line.id!].productionHours.push((quantity) => {
return (
hoursPerProductionStandard *
quantity *
@@ -187,7 +188,7 @@ const $quotationLinePriceEffects = computed($quotationStore, (store) => {
);
});
if (operation.quotingRate) {
- effects[line.id].overheadCost.push((quantity) => {
+ effects[line.id!].overheadCost.push((quantity) => {
return (
hoursPerProductionStandard *
quantity *
@@ -196,7 +197,7 @@ const $quotationLinePriceEffects = computed($quotationStore, (store) => {
);
});
} else {
- effects[line.id].laborCost.push((quantity) => {
+ effects[line.id!].laborCost.push((quantity) => {
return (
hoursPerProductionStandard *
quantity *
@@ -204,7 +205,7 @@ const $quotationLinePriceEffects = computed($quotationStore, (store) => {
(operation.laborRate ?? 0)
);
});
- effects[line.id].overheadCost.push((quantity) => {
+ effects[line.id!].overheadCost.push((quantity) => {
return (
hoursPerProductionStandard *
quantity *
diff --git a/apps/carbon/app/routes/api+/item.$type.ts b/apps/carbon/app/routes/api+/item.$type.ts
index 17345eb00a..5204507058 100644
--- a/apps/carbon/app/routes/api+/item.$type.ts
+++ b/apps/carbon/app/routes/api+/item.$type.ts
@@ -37,7 +37,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
const update = await updateItem(client, {
...validation.data,
- type: type as "part",
+ type: type as "Part",
companyId,
});
diff --git a/apps/carbon/app/routes/x+/documents+/search.view.$documentId.tsx b/apps/carbon/app/routes/x+/documents+/search.view.$documentId.tsx
index dab4d2fd60..238418edaa 100644
--- a/apps/carbon/app/routes/x+/documents+/search.view.$documentId.tsx
+++ b/apps/carbon/app/routes/x+/documents+/search.view.$documentId.tsx
@@ -1,7 +1,7 @@
import type { LoaderFunctionArgs } from "@remix-run/node";
import { json, redirect } from "@remix-run/node";
import { useLoaderData } from "@remix-run/react";
-import { getDocument, getDocumentType } from "~/modules/documents";
+import { getDocument } from "~/modules/documents";
import DocumentView from "~/modules/documents/ui/Documents/DocumentView";
import { requirePermissions } from "~/services/auth/auth.server";
import { flash } from "~/services/session.server";
@@ -25,29 +25,19 @@ export async function loader({ request, params }: LoaderFunctionArgs) {
await flash(request, error(document.error, "Failed to get document"))
);
}
- let documentType;
- if (document?.data?.name) {
- documentType = getDocumentType(document?.data?.name);
- }
return json({
document: document.data,
- type: documentType,
});
}
export default function ViewDocumentRoute() {
- const { document, type } = useLoaderData<typeof loader>();
+ const { document } = useLoaderData<typeof loader>();
let name = document.name;
if (name) name = name.split(".").slice(0, -1).join(".");
return (
- <DocumentView
- key={document.id}
- bucket={"private"}
- type={type ?? ""}
- document={document}
- />
+ <DocumentView key={document.id} bucket={"private"} document={document} />
);
}
diff --git a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.new.tsx b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.new.tsx
index af4c781818..175cb9cad3 100644
--- a/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.new.tsx
+++ b/apps/carbon/app/routes/x+/purchase-invoice+/$invoiceId.lines.new.tsx
@@ -66,7 +66,7 @@ export default function NewPurchaseInvoiceLineRoute() {
const initialValues = {
invoiceId: invoiceId,
invoiceLineType: "Part" as PurchaseInvoiceLineType,
- partId: "",
+ itemId: "",
quantity: 1,
unitPrice: 0,
setupPrice: 0,
diff --git a/apps/carbon/app/routes/x+/purchase-order+/$orderId.lines.new.tsx b/apps/carbon/app/routes/x+/purchase-order+/$orderId.lines.new.tsx
index cb4f5e75c2..ce6598b3c8 100644
--- a/apps/carbon/app/routes/x+/purchase-order+/$orderId.lines.new.tsx
+++ b/apps/carbon/app/routes/x+/purchase-order+/$orderId.lines.new.tsx
@@ -66,7 +66,7 @@ export default function NewPurchaseOrderLineRoute() {
const initialValues = {
purchaseOrderId: orderId,
purchaseOrderLineType: "Part" as PurchaseOrderLineType,
- partId: "",
+ itemId: "",
purchaseQuantity: 1,
unitPrice: 0,
setupPrice: 0,
diff --git a/apps/carbon/app/routes/x+/quote+/$id.convert-to-order.tsx b/apps/carbon/app/routes/x+/quote+/$id.convert-to-order.tsx
index 5747c43968..c8c40c4720 100644
--- a/apps/carbon/app/routes/x+/quote+/$id.convert-to-order.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$id.convert-to-order.tsx
@@ -92,7 +92,7 @@ export async function action(args: ActionFunctionArgs) {
salesOrderId: newSalesOrderId,
salesOrderLineType: "Part" as "Part",
companyId,
- partId: quoteLine.partId!,
+ itemId: quoteLine.itemId!,
description: quoteLine.description!,
createdBy: userId,
};
diff --git a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.$assemblyId.delete.tsx b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.$assemblyId.delete.tsx
index 2a702f9053..f2c3df6b79 100644
--- a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.$assemblyId.delete.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.$assemblyId.delete.tsx
@@ -54,8 +54,8 @@ export default function DeleteQuoteAssembly() {
return (
<ConfirmDelete
action={path.to.deleteQuoteAssembly(id, lineId, assemblyId)}
- name={routeData?.quoteAssembly.partId}
- text={`Are you sure you want to delete the assembly: ${routeData?.quoteAssembly.partId}? This cannot be undone.`}
+ name={routeData?.quoteAssembly.itemId}
+ text={`Are you sure you want to delete the assembly: ${routeData?.quoteAssembly.itemId}? This cannot be undone.`}
onCancel={() => navigate(path.to.quoteAssembly(id, lineId, assemblyId))}
/>
);
diff --git a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.$assemblyId.tsx b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.$assemblyId.tsx
index 194f2cde5a..f26c4a7a34 100644
--- a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.$assemblyId.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.$assemblyId.tsx
@@ -92,7 +92,7 @@ export default function QuoteAssembly() {
quoteId: quoteAssembly.quoteId,
quoteLineId: quoteAssembly.quoteLineId,
parentAssemblyId: quoteAssembly.parentAssemblyId ?? undefined,
- partId: quoteAssembly.partId,
+ itemId: quoteAssembly.itemId,
description: quoteAssembly.description ?? "",
quantityPerParent: quoteAssembly.quantityPerParent,
unitOfMeasureCode: quoteAssembly.unitOfMeasureCode ?? "",
diff --git a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.new.tsx b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.new.tsx
index 0eba7c1627..50f4966c05 100644
--- a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.new.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.assembly.new.tsx
@@ -72,7 +72,7 @@ export default function NewQuoteAssembly() {
quoteId,
quoteLineId: lineId,
parentAssemblyId: parentAssemblyId ?? undefined,
- partId: "",
+ itemId: "",
description: "",
quantityPerParent: 1,
};
diff --git a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.details.delete.tsx b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.details.delete.tsx
index 13d6c287ac..41d3d9dd02 100644
--- a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.details.delete.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.details.delete.tsx
@@ -53,8 +53,8 @@ export default function DeleteQuoteLine() {
return (
<ConfirmDelete
action={path.to.deleteQuoteLine(id, lineId)}
- name={routeData?.quotationLine.partId ?? "this line"}
- text={`Are you sure you want to delete the line: ${routeData?.quotationLine.partId}? This cannot be undone.`}
+ name={routeData?.quotationLine.itemReadableId ?? "this line"}
+ text={`Are you sure you want to delete the line: ${routeData?.quotationLine.itemReadableId}? This cannot be undone.`}
onCancel={onCancel}
/>
);
diff --git a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.details.tsx b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.details.tsx
index 5f2124f72d..2e50b997dc 100644
--- a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.details.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.details.tsx
@@ -117,7 +117,7 @@ export default function EditQuotationLineRoute() {
const lineInitialValues = {
id: quotationLine?.id ?? undefined,
quoteId: quotationLine?.quoteId ?? "",
- partId: quotationLine?.partId ?? "",
+ itemId: quotationLine?.itemId ?? "",
description: quotationLine?.description ?? "",
customerPartId: quotationLine?.customerPartId ?? "",
customerPartRevision: quotationLine?.customerPartRevision ?? "",
diff --git a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.$operationId.material.new.tsx b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.$operationId.material.new.tsx
index 4b0f8e8c84..172acc4055 100644
--- a/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.$operationId.material.new.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$id.lines.$lineId.operation.$operationId.material.new.tsx
@@ -67,7 +67,7 @@ export async function action({ request, params }: ActionFunctionArgs) {
export default function NewQuoteMaterial() {
const initialValues = {
- partId: "",
+ itemId: "",
quantity: 1,
description: "",
unitCost: 0,
diff --git a/apps/carbon/app/routes/x+/quote+/$id.lines.delete.$lineId.tsx b/apps/carbon/app/routes/x+/quote+/$id.lines.delete.$lineId.tsx
index 74fdcdf236..600b3bd70d 100644
--- a/apps/carbon/app/routes/x+/quote+/$id.lines.delete.$lineId.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$id.lines.delete.$lineId.tsx
@@ -72,7 +72,7 @@ export default function DeleteQuoteLineRoute() {
<ConfirmDelete
action={path.to.deleteQuoteLine(id, lineId)}
name="Quote Line"
- text={`Are you sure you want to delete the quotation line for ${quotationLine.partId}? This cannot be undone.`}
+ text={`Are you sure you want to delete the quotation line for ${quotationLine.itemReadableId}? This cannot be undone.`}
onCancel={onCancel}
/>
);
diff --git a/apps/carbon/app/routes/x+/quote+/$id.new.tsx b/apps/carbon/app/routes/x+/quote+/$id.new.tsx
index 953a6e32b6..3a3543ae86 100644
--- a/apps/carbon/app/routes/x+/quote+/$id.new.tsx
+++ b/apps/carbon/app/routes/x+/quote+/$id.new.tsx
@@ -70,7 +70,7 @@ export default function NewQuotationLineRoute() {
const initialValues = {
quoteId: id,
- partId: "",
+ itemId: "",
description: "",
replenishmentSystem: "" as "Buy" | "Make",
unitOfMeasureCode: "",
diff --git a/apps/carbon/app/routes/x+/sales-order+/$orderId.lines.$lineId.tsx b/apps/carbon/app/routes/x+/sales-order+/$orderId.lines.$lineId.tsx
index 4e47036a20..9a643e0e23 100644
--- a/apps/carbon/app/routes/x+/sales-order+/$orderId.lines.$lineId.tsx
+++ b/apps/carbon/app/routes/x+/sales-order+/$orderId.lines.$lineId.tsx
@@ -53,19 +53,19 @@ export async function action({ request, params }: ActionFunctionArgs) {
const { id, ...data } = validation.data;
- if (data.salesOrderLineType === "Part") {
+ if (data.salesOrderLineType === "Comment") {
data.accountNumber = undefined;
data.assetId = undefined;
- data.serviceId = undefined;
- } else if (data.salesOrderLineType === "Service") {
+ data.itemId = undefined;
+ } else if (data.salesOrderLineType === "Fixed Asset") {
data.accountNumber = undefined;
+ data.itemId = undefined;
+ } else if (data.salesOrderLineType === "GL Account") {
data.assetId = undefined;
- data.partId = undefined;
- } else if (data.salesOrderLineType === "Comment") {
+ data.itemId = undefined;
+ } else {
data.accountNumber = undefined;
data.assetId = undefined;
- data.partId = undefined;
- data.serviceId = undefined;
}
const updateSalesOrderLine = await upsertSalesOrderLine(client, {
@@ -96,8 +96,8 @@ export default function EditSalesOrderLineRoute() {
salesOrderId: salesOrderLine?.salesOrderId ?? "",
salesOrderLineType:
salesOrderLine?.salesOrderLineType ?? ("Part" as SalesOrderLineType),
- partId: salesOrderLine?.partId ?? "",
- serviceId: salesOrderLine?.serviceId ?? "",
+ itemId: salesOrderLine?.itemId ?? "",
+ itemReadableId: salesOrderLine?.itemReadableId ?? "",
accountNumber: salesOrderLine?.accountNumber ?? "",
assetId: salesOrderLine?.assetId ?? "",
description: salesOrderLine?.description ?? "",
diff --git a/apps/carbon/app/routes/x+/sales-order+/$orderId.lines.new.tsx b/apps/carbon/app/routes/x+/sales-order+/$orderId.lines.new.tsx
index e738f29bc7..03f9a28da5 100644
--- a/apps/carbon/app/routes/x+/sales-order+/$orderId.lines.new.tsx
+++ b/apps/carbon/app/routes/x+/sales-order+/$orderId.lines.new.tsx
@@ -63,7 +63,7 @@ export default function NewSalesOrderLineRoute() {
const initialValues = {
salesOrderId: orderId,
salesOrderLineType: "Part" as SalesOrderLineType,
- partId: "",
+ itemId: "",
saleQuantity: 1,
unitPrice: 0,
setupPrice: 0,
diff --git a/apps/carbon/app/utils/path.ts b/apps/carbon/app/utils/path.ts
index a35505ef87..222ac33b3d 100644
--- a/apps/carbon/app/utils/path.ts
+++ b/apps/carbon/app/utils/path.ts
@@ -384,8 +384,8 @@ export const path = {
partPurchasing: (id: string) => generatePath(`${x}/part/${id}/purchasing`),
partRoot: `${x}/part`,
partSalePrice: (id: string) => generatePath(`${x}/part/${id}/sale-price`),
- partSupplier: (partId: string, id: string) =>
- generatePath(`${x}/part/${partId}/suppliers/${id}`),
+ partSupplier: (itemId: string, id: string) =>
+ generatePath(`${x}/part/${itemId}/suppliers/${id}`),
partSuppliers: (id: string) => generatePath(`${x}/part/${id}/suppliers`),
parts: `${x}/parts`,
partsSearch: `${x}/parts/search`,
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 324330a246..1ad7107c66 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -11328,6 +11328,7 @@ export type Database = {
description: string
id: string
itemId: string
+ itemReadableId: string | null
quoteId: string
quoteRevisionId: number
replenishmentSystem: string | null
@@ -11345,6 +11346,7 @@ export type Database = {
description: string
id?: string
itemId: string
+ itemReadableId?: string | null
quoteId: string
quoteRevisionId?: number
replenishmentSystem?: string | null
@@ -11362,6 +11364,7 @@ export type Database = {
description?: string
id?: string
itemId?: string
+ itemReadableId?: string | null
quoteId?: string
quoteRevisionId?: number
replenishmentSystem?: string | null
@@ -20420,14 +20423,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["supplierCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["id"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["supplierCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["id"]
@@ -20754,6 +20757,7 @@ export type Database = {
description: string | null
id: string | null
itemId: string | null
+ itemReadableId: string | null
pricingDiscountPercent: number | null
pricingExtendedPrice: number | null
pricingLeadTime: number | null
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 324330a246..1ad7107c66 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -11328,6 +11328,7 @@ export type Database = {
description: string
id: string
itemId: string
+ itemReadableId: string | null
quoteId: string
quoteRevisionId: number
replenishmentSystem: string | null
@@ -11345,6 +11346,7 @@ export type Database = {
description: string
id?: string
itemId: string
+ itemReadableId?: string | null
quoteId: string
quoteRevisionId?: number
replenishmentSystem?: string | null
@@ -11362,6 +11364,7 @@ export type Database = {
description?: string
id?: string
itemId?: string
+ itemReadableId?: string | null
quoteId?: string
quoteRevisionId?: number
replenishmentSystem?: string | null
@@ -20420,14 +20423,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["supplierCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["id"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["supplierCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["id"]
@@ -20754,6 +20757,7 @@ export type Database = {
description: string | null
id: string | null
itemId: string | null
+ itemReadableId: string | null
pricingDiscountPercent: number | null
pricingExtendedPrice: number | null
pricingLeadTime: number | null
diff --git a/packages/database/supabase/migrations/20240206224405_quotes.sql b/packages/database/supabase/migrations/20240206224405_quotes.sql
index 7c335ab250..547a6d57b2 100644
--- a/packages/database/supabase/migrations/20240206224405_quotes.sql
+++ b/packages/database/supabase/migrations/20240206224405_quotes.sql
@@ -65,6 +65,7 @@ CREATE TABLE "quoteLine" (
"quoteRevisionId" INTEGER NOT NULL DEFAULT 0,
"status" "quoteLineStatus" NOT NULL DEFAULT 'Draft',
"itemId" TEXT NOT NULL,
+ "itemReadableId" TEXT,
"description" TEXT NOT NULL,
"customerPartId" TEXT,
"customerPartRevision" TEXT,