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
feat: supplier quote explorer
Brad Barbin38cab38f4027
diff --git a/apps/carbon/app/modules/purchasing/purchasing.service.ts b/apps/carbon/app/modules/purchasing/purchasing.service.tsindex 230c88fced..cffd0b1150 100644--- a/apps/carbon/app/modules/purchasing/purchasing.service.ts+++ b/apps/carbon/app/modules/purchasing/purchasing.service.ts@@ -143,6 +143,13 @@ export async function deleteSupplierQuote(return quote;}+export async function deleteSupplierQuoteLine(+ client: SupabaseClient<Database>,+ id: string+) {+ return client.from("supplierQuoteLine").delete().eq("id", id);+}+export async function deleteSupplierStatus(client: SupabaseClient<Database>,supplierStatusId: string@@ -479,7 +486,7 @@ export async function getSupplierQuoteLines(supplierQuoteId: string) {return client- .from("supplierQuoteLine")+ .from("supplierQuoteLines").select("*").eq("supplierQuoteId", supplierQuoteId);}diff --git a/apps/carbon/app/modules/purchasing/types.ts b/apps/carbon/app/modules/purchasing/types.tsindex f654b09c38..afff654349 100644--- a/apps/carbon/app/modules/purchasing/types.ts+++ b/apps/carbon/app/modules/purchasing/types.ts@@ -8,6 +8,8 @@ import type {getSupplierInteractionByQuote,getSupplierLocations,getSupplierProcessesBySupplier,+ getSupplierQuoteLinePricesByQuoteId,+ getSupplierQuoteLines,getSupplierQuotes,getSuppliers,getSupplierStatuses,@@ -67,6 +69,14 @@ export type SupplierQuote = NonNullable<Awaited<ReturnType<typeof getSupplierQuotes>>["data"]>[number];+export type SupplierQuoteLine = NonNullable<+ Awaited<ReturnType<typeof getSupplierQuoteLines>>["data"]+>[number];++export type SupplierQuoteLinePrice = NonNullable<+ Awaited<ReturnType<typeof getSupplierQuoteLinePricesByQuoteId>>["data"]+>[number];+export type SupplierStatus = NonNullable<Awaited<ReturnType<typeof getSupplierStatuses>>["data"]>[number];diff --git a/apps/carbon/app/modules/purchasing/ui/SupplierQuote/DeleteSupplierQuoteLine.tsx b/apps/carbon/app/modules/purchasing/ui/SupplierQuote/DeleteSupplierQuoteLine.tsxnew file mode 100644index 0000000000..5e45b7587d--- /dev/null+++ b/apps/carbon/app/modules/purchasing/ui/SupplierQuote/DeleteSupplierQuoteLine.tsx@@ -0,0 +1,26 @@+import { useParams } from "@remix-run/react";+import { ConfirmDelete } from "~/components/Modals";+import { path } from "~/utils/path";+import type { SupplierQuoteLine } from "../../types";++export default function DeleteSupplierQuoteLine({+ line,+ onCancel,+}: {+ line: SupplierQuoteLine;+ onCancel: () => void;+}) {+ const { id } = useParams();+ if (!id) throw new Error("id not found");+ if (!line.id) return null;++ return (+ <ConfirmDelete+ action={path.to.deleteSupplierQuoteLine(id, line.id)}+ name={line.itemReadableId ?? "this line"}+ text={`Are you sure you want to delete the line: ${line.itemReadableId}? This cannot be undone.`}+ onCancel={onCancel}+ onSubmit={onCancel}+ />+ );+}diff --git a/apps/carbon/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteExplorer.tsx b/apps/carbon/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteExplorer.tsxnew file mode 100644index 0000000000..eff93e65ad--- /dev/null+++ b/apps/carbon/app/modules/purchasing/ui/SupplierQuote/SupplierQuoteExplorer.tsx@@ -0,0 +1,224 @@+import {+ Button,+ cn,+ DropdownMenu,+ DropdownMenuContent,+ DropdownMenuIcon,+ DropdownMenuItem,+ DropdownMenuTrigger,+ HStack,+ IconButton,+ Kbd,+ Tooltip,+ TooltipContent,+ TooltipTrigger,+ useDisclosure,+ useKeyboardShortcuts,+ useMount,+ VStack,+} from "@carbon/react";+import { prettifyKeyboardShortcut } from "@carbon/utils";+import { Link, useParams } from "@remix-run/react";+import { useRef, useState } from "react";+import { LuMoreVertical, LuPlusCircle, LuTrash } from "react-icons/lu";+import { Empty, ItemThumbnail } from "~/components";+import { useOptimisticLocation, usePermissions, useRouteData } from "~/hooks";+import { path } from "~/utils/path";+import type { Supplier, SupplierQuote, SupplierQuoteLine } from "../../types";+import DeleteSupplierQuoteLine from "./DeleteSupplierQuoteLine";+import SupplierQuoteLineForm from "./SupplierQuoteLineForm";++export default function SupplierQuoteExplorer() {+ const { id } = useParams();+ if (!id) throw new Error("Could not find id");+ const routeData = useRouteData<{+ quote: SupplierQuote;+ lines: SupplierQuoteLine[];+ supplier: Supplier;+ }>(path.to.supplierQuote(id));+ const permissions = usePermissions();++ const supplierQuoteLineInitialValues = {+ supplierQuoteId: id,+ supplierQuoteLineType: "Part" as const,+ saleQuantity: 1,+ unitPrice: 0,+ addOnCost: 0,+ shippingCost: 0,+ };++ const newSupplierQuoteLineDisclosure = useDisclosure();+ const deleteLineDisclosure = useDisclosure();+ const [deleteLine, setDeleteLine] = useState<SupplierQuoteLine | null>(null);+ const isDisabled = routeData?.quote?.status !== "Draft";++ const onDeleteLine = (line: SupplierQuoteLine) => {+ setDeleteLine(line);+ deleteLineDisclosure.onOpen();+ };++ const onDeleteCancel = () => {+ setDeleteLine(null);+ deleteLineDisclosure.onClose();+ };++ const newButtonRef = useRef<HTMLButtonElement>(null);+ useKeyboardShortcuts({+ "Command+Shift+l": (event: KeyboardEvent) => {+ event.stopPropagation();+ newButtonRef.current?.click();+ },+ });++ return (+ <>+ <VStack className="w-full h-[calc(100dvh-99px)] justify-between">+ <VStack+ className="flex-1 overflow-y-auto scrollbar-thin scrollbar-track-transparent scrollbar-thumb-accent"+ spacing={0}+ >+ {routeData?.lines && routeData?.lines?.length > 0 ? (+ routeData?.lines.map((line) => (+ <SupplierQuoteLineItem+ key={line.id}+ isDisabled={isDisabled}+ line={line}+ onDelete={onDeleteLine}+ />+ ))+ ) : (+ <Empty>+ {permissions.can("update", "sales") && (+ <Button+ isDisabled={isDisabled}+ leftIcon={<LuPlusCircle />}+ variant="secondary"+ onClick={newSupplierQuoteLineDisclosure.onOpen}+ >+ Add Line Item+ </Button>+ )}+ </Empty>+ )}+ </VStack>+ <div className="w-full flex flex-0 sm:flex-row border-t border-border p-4 sm:justify-start sm:space-x-2">+ <Tooltip>+ <TooltipTrigger className="w-full">+ <Button+ ref={newButtonRef}+ className="w-full"+ isDisabled={isDisabled || !permissions.can("update", "sales")}+ leftIcon={<LuPlusCircle />}+ variant="secondary"+ onClick={newSupplierQuoteLineDisclosure.onOpen}+ >+ Add Line Item+ </Button>+ </TooltipTrigger>+ <TooltipContent>+ <HStack>+ <span>New Line Item</span>+ <Kbd>{prettifyKeyboardShortcut("Command+Shift+l")}</Kbd>+ </HStack>+ </TooltipContent>+ </Tooltip>+ </div>+ </VStack>+ {newSupplierQuoteLineDisclosure.isOpen && (+ <SupplierQuoteLineForm+ initialValues={supplierQuoteLineInitialValues}+ type="modal"+ onClose={newSupplierQuoteLineDisclosure.onClose}+ />+ )}+ {deleteLineDisclosure.isOpen && (+ <DeleteSupplierQuoteLine line={deleteLine!} onCancel={onDeleteCancel} />+ )}+ </>+ );+}++type SupplierQuoteLineItemProps = {+ line: SupplierQuoteLine;+ isDisabled: boolean;+ onDelete: (line: SupplierQuoteLine) => void;+};++function SupplierQuoteLineItem({+ line,+ isDisabled,+ onDelete,+}: SupplierQuoteLineItemProps) {+ const { id, lineId } = useParams();+ if (!id) throw new Error("Could not find id");+ const permissions = usePermissions();+ const disclosure = useDisclosure();+ const location = useOptimisticLocation();++ useMount(() => {+ if (lineId === line.id) {+ disclosure.onOpen();+ }+ });++ const isSelected =+ location.pathname === path.to.supplierQuoteLine(id, line.id!);++ return (+ <VStack spacing={0}>+ <Link+ to={path.to.supplierQuoteLine(id, line.id!)}+ prefetch="intent"+ className="w-full"+ >+ <HStack+ className={cn(+ "w-full p-2 items-center justify-between hover:bg-accent/30 cursor-pointer",+ !disclosure.isOpen && "border-b border-border",+ isSelected && "bg-accent/60 hover:bg-accent/50 shadow-inner"+ )}+ >+ <HStack spacing={2}>+ <ItemThumbnail+ thumbnailPath={line.thumbnailPath}+ type="Part" // TODO+ />++ <VStack spacing={0}>+ <span className="font-semibold line-clamp-1">+ {line.itemReadableId}+ </span>+ <span className="text-muted-foreground text-xs truncate line-clamp-1">+ {line.description}+ </span>+ </VStack>+ </HStack>+ <HStack spacing={0}>+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <IconButton+ aria-label="More"+ icon={<LuMoreVertical />}+ variant="ghost"+ onClick={(e) => e.stopPropagation()}+ />+ </DropdownMenuTrigger>+ <DropdownMenuContent>+ <DropdownMenuItem+ disabled={isDisabled || !permissions.can("update", "sales")}+ onClick={(e) => {+ e.stopPropagation();+ onDelete(line);+ }}+ >+ <DropdownMenuIcon icon={<LuTrash />} />+ Delete Line+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ </HStack>+ </HStack>+ </Link>+ </VStack>+ );+}diff --git a/apps/carbon/app/routes/x+/supplier-quote+/$quoteId.$lineId.delete.tsx b/apps/carbon/app/routes/x+/supplier-quote+/$id.$lineId.delete.tsxsimilarity index 63%rename from apps/carbon/app/routes/x+/supplier-quote+/$quoteId.$lineId.delete.tsxrename to apps/carbon/app/routes/x+/supplier-quote+/$id.$lineId.delete.tsxindex c56094f2b3..1bdb058e26 100644--- a/apps/carbon/app/routes/x+/supplier-quote+/$quoteId.$lineId.delete.tsx+++ b/apps/carbon/app/routes/x+/supplier-quote+/$id.$lineId.delete.tsx@@ -4,7 +4,7 @@ import { assertIsPost, error } from "@carbon/auth";import { requirePermissions } from "@carbon/auth/auth.server";import { flash } from "@carbon/auth/session.server";import type { ActionFunctionArgs } from "@vercel/remix";-import { deleteQuoteLine } from "~/modules/sales";+import { deleteSupplierQuoteLine } from "~/modules/purchasing";import { path } from "~/utils/path";export async function action({ request, params }: ActionFunctionArgs) {@@ -13,15 +13,15 @@ export async function action({ request, params }: ActionFunctionArgs) {delete: "sales",});- const { quoteId, lineId: quoteLineId } = params;- if (!quoteId) throw new Error("Could not find quoteId");- if (!quoteLineId) throw new Error("Could not find quoteLineId");+ const { id, lineId } = params;+ if (!id) throw new Error("Could not find quoteId");+ if (!lineId) throw new Error("Could not find quoteLineId");- const deleteLine = await deleteQuoteLine(client, quoteLineId);+ const deleteLine = await deleteSupplierQuoteLine(client, lineId);if (deleteLine.error) {return json(- path.to.quoteLine(quoteId, quoteLineId),+ path.to.supplierQuoteLine(id, lineId),await flash(request,error(deleteLine.error, "Failed to update quote line")@@ -29,5 +29,5 @@ export async function action({ request, params }: ActionFunctionArgs) {);}- throw redirect(path.to.quote(quoteId));+ throw redirect(path.to.supplierQuote(id));}diff --git a/apps/carbon/app/utils/path.ts b/apps/carbon/app/utils/path.tsindex 3c9bd3d871..1ffc8738ef 100644--- a/apps/carbon/app/utils/path.ts+++ b/apps/carbon/app/utils/path.ts@@ -317,6 +317,8 @@ export const path = {generatePath(`${x}/supplier/${supplierId}/processes/delete/${id}`),deleteSupplierQuote: (id: string) =>generatePath(`${x}/supplier-quote/${id}/delete`),+ deleteSupplierQuoteLine: (id: string, lineId: string) =>+ generatePath(`${x}/supplier-quote/${id}/${lineId}/delete`),deleteSupplierStatus: (id: string) =>generatePath(`${x}/purchasing/supplier-statuses/delete/${id}`),deleteSupplierType: (id: string) =>@@ -798,6 +800,8 @@ export const path = {supplierQuoteFavorite: `${x}/purchasing/quotes/favorite`,supplierQuoteDetails: (id: string) =>generatePath(`${x}/supplier-quote/${id}/details`),+ supplierQuoteLine: (id: string, lineId: string) =>+ generatePath(`${x}/supplier-quote/${id}/${lineId}/details`),supplierRoot: `${x}/supplier`,supplierStatus: (id: string) =>generatePath(`${x}/purchasing/supplier-statuses/${id}`),diff --git a/packages/database/src/types.ts b/packages/database/src/types.tsindex 4f7bc8b7a4..5226f69952 100644--- a/packages/database/src/types.ts+++ b/packages/database/src/types.ts@@ -21906,6 +21906,13 @@ export type Database = {referencedRelation: "supplierQuoteLine";referencedColumns: ["id"];},+ {+ foreignKeyName: "supplierQuoteLinePrice_supplierQuoteLineId_fkey";+ columns: ["supplierQuoteLineId"];+ isOneToOne: false;+ referencedRelation: "supplierQuoteLines";+ referencedColumns: ["id"];+ },{foreignKeyName: "supplierQuoteLinePrice_updatedBy_fkey";columns: ["updatedBy"];@@ -30238,6 +30245,166 @@ export type Database = {}];};+ supplierQuoteLines: {+ Row: {+ companyId: string | null;+ conversionFactor: number | null;+ createdBy: string | null;+ customFields: Json | null;+ description: string | null;+ id: string | null;+ inventoryUnitOfMeasureCode: string | null;+ itemId: string | null;+ itemReadableId: string | null;+ notes: Json | null;+ purchaseUnitOfMeasureCode: string | null;+ supplierPartId: string | null;+ supplierPartRevision: string | null;+ supplierQuoteId: string | null;+ supplierQuoteRevisionId: number | null;+ tags: string[] | null;+ taxPercent: number | null;+ thumbnailPath: string | null;+ unitCost: number | null;+ updatedAt: string | null;+ updatedBy: string | null;+ };+ Relationships: [+ {+ foreignKeyName: "supplierQuoteLine_companyId_fkey";+ columns: ["companyId"];+ isOneToOne: false;+ referencedRelation: "company";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_companyId_fkey";+ columns: ["companyId"];+ isOneToOne: false;+ referencedRelation: "companies";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_companyId_fkey";+ columns: ["companyId"];+ isOneToOne: false;+ referencedRelation: "customFieldTables";+ referencedColumns: ["companyId"];+ },+ {+ foreignKeyName: "supplierQuoteLine_companyId_fkey";+ columns: ["companyId"];+ isOneToOne: false;+ referencedRelation: "integrations";+ referencedColumns: ["companyId"];+ },+ {+ foreignKeyName: "supplierQuoteLine_createdBy_fkey";+ columns: ["createdBy"];+ isOneToOne: false;+ referencedRelation: "user";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_createdBy_fkey";+ columns: ["createdBy"];+ isOneToOne: false;+ referencedRelation: "employeeSummary";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_createdBy_fkey";+ columns: ["createdBy"];+ isOneToOne: false;+ referencedRelation: "employees";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_createdBy_fkey";+ columns: ["createdBy"];+ isOneToOne: false;+ referencedRelation: "employeesAcrossCompanies";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_createdBy_fkey";+ columns: ["createdBy"];+ isOneToOne: false;+ referencedRelation: "userDefaults";+ referencedColumns: ["userId"];+ },+ {+ foreignKeyName: "supplierQuoteLine_inventoryUnitOfMeasureCode_fkey";+ columns: ["inventoryUnitOfMeasureCode", "companyId"];+ isOneToOne: false;+ referencedRelation: "unitOfMeasure";+ referencedColumns: ["code", "companyId"];+ },+ {+ foreignKeyName: "supplierQuoteLine_itemId_fkey";+ columns: ["itemId"];+ isOneToOne: false;+ referencedRelation: "item";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_purchaseUnitOfMeasureCode_fkey";+ columns: ["purchaseUnitOfMeasureCode", "companyId"];+ isOneToOne: false;+ referencedRelation: "unitOfMeasure";+ referencedColumns: ["code", "companyId"];+ },+ {+ foreignKeyName: "supplierQuoteLine_supplierQuoteId_fkey";+ columns: ["supplierQuoteId"];+ isOneToOne: false;+ referencedRelation: "supplierQuote";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_supplierQuoteId_fkey";+ columns: ["supplierQuoteId"];+ isOneToOne: false;+ referencedRelation: "supplierQuotes";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_updatedBy_fkey";+ columns: ["updatedBy"];+ isOneToOne: false;+ referencedRelation: "user";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_updatedBy_fkey";+ columns: ["updatedBy"];+ isOneToOne: false;+ referencedRelation: "employeeSummary";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_updatedBy_fkey";+ columns: ["updatedBy"];+ isOneToOne: false;+ referencedRelation: "employees";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_updatedBy_fkey";+ columns: ["updatedBy"];+ isOneToOne: false;+ referencedRelation: "employeesAcrossCompanies";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_updatedBy_fkey";+ columns: ["updatedBy"];+ isOneToOne: false;+ referencedRelation: "userDefaults";+ referencedColumns: ["userId"];+ }+ ];+ };supplierQuotes: {Row: {assignee: string | null;diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.tsindex 4f7bc8b7a4..5226f69952 100644--- a/packages/database/supabase/functions/lib/types.ts+++ b/packages/database/supabase/functions/lib/types.ts@@ -21906,6 +21906,13 @@ export type Database = {referencedRelation: "supplierQuoteLine";referencedColumns: ["id"];},+ {+ foreignKeyName: "supplierQuoteLinePrice_supplierQuoteLineId_fkey";+ columns: ["supplierQuoteLineId"];+ isOneToOne: false;+ referencedRelation: "supplierQuoteLines";+ referencedColumns: ["id"];+ },{foreignKeyName: "supplierQuoteLinePrice_updatedBy_fkey";columns: ["updatedBy"];@@ -30238,6 +30245,166 @@ export type Database = {}];};+ supplierQuoteLines: {+ Row: {+ companyId: string | null;+ conversionFactor: number | null;+ createdBy: string | null;+ customFields: Json | null;+ description: string | null;+ id: string | null;+ inventoryUnitOfMeasureCode: string | null;+ itemId: string | null;+ itemReadableId: string | null;+ notes: Json | null;+ purchaseUnitOfMeasureCode: string | null;+ supplierPartId: string | null;+ supplierPartRevision: string | null;+ supplierQuoteId: string | null;+ supplierQuoteRevisionId: number | null;+ tags: string[] | null;+ taxPercent: number | null;+ thumbnailPath: string | null;+ unitCost: number | null;+ updatedAt: string | null;+ updatedBy: string | null;+ };+ Relationships: [+ {+ foreignKeyName: "supplierQuoteLine_companyId_fkey";+ columns: ["companyId"];+ isOneToOne: false;+ referencedRelation: "company";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_companyId_fkey";+ columns: ["companyId"];+ isOneToOne: false;+ referencedRelation: "companies";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_companyId_fkey";+ columns: ["companyId"];+ isOneToOne: false;+ referencedRelation: "customFieldTables";+ referencedColumns: ["companyId"];+ },+ {+ foreignKeyName: "supplierQuoteLine_companyId_fkey";+ columns: ["companyId"];+ isOneToOne: false;+ referencedRelation: "integrations";+ referencedColumns: ["companyId"];+ },+ {+ foreignKeyName: "supplierQuoteLine_createdBy_fkey";+ columns: ["createdBy"];+ isOneToOne: false;+ referencedRelation: "user";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_createdBy_fkey";+ columns: ["createdBy"];+ isOneToOne: false;+ referencedRelation: "employeeSummary";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_createdBy_fkey";+ columns: ["createdBy"];+ isOneToOne: false;+ referencedRelation: "employees";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_createdBy_fkey";+ columns: ["createdBy"];+ isOneToOne: false;+ referencedRelation: "employeesAcrossCompanies";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_createdBy_fkey";+ columns: ["createdBy"];+ isOneToOne: false;+ referencedRelation: "userDefaults";+ referencedColumns: ["userId"];+ },+ {+ foreignKeyName: "supplierQuoteLine_inventoryUnitOfMeasureCode_fkey";+ columns: ["inventoryUnitOfMeasureCode", "companyId"];+ isOneToOne: false;+ referencedRelation: "unitOfMeasure";+ referencedColumns: ["code", "companyId"];+ },+ {+ foreignKeyName: "supplierQuoteLine_itemId_fkey";+ columns: ["itemId"];+ isOneToOne: false;+ referencedRelation: "item";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_purchaseUnitOfMeasureCode_fkey";+ columns: ["purchaseUnitOfMeasureCode", "companyId"];+ isOneToOne: false;+ referencedRelation: "unitOfMeasure";+ referencedColumns: ["code", "companyId"];+ },+ {+ foreignKeyName: "supplierQuoteLine_supplierQuoteId_fkey";+ columns: ["supplierQuoteId"];+ isOneToOne: false;+ referencedRelation: "supplierQuote";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_supplierQuoteId_fkey";+ columns: ["supplierQuoteId"];+ isOneToOne: false;+ referencedRelation: "supplierQuotes";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_updatedBy_fkey";+ columns: ["updatedBy"];+ isOneToOne: false;+ referencedRelation: "user";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_updatedBy_fkey";+ columns: ["updatedBy"];+ isOneToOne: false;+ referencedRelation: "employeeSummary";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_updatedBy_fkey";+ columns: ["updatedBy"];+ isOneToOne: false;+ referencedRelation: "employees";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_updatedBy_fkey";+ columns: ["updatedBy"];+ isOneToOne: false;+ referencedRelation: "employeesAcrossCompanies";+ referencedColumns: ["id"];+ },+ {+ foreignKeyName: "supplierQuoteLine_updatedBy_fkey";+ columns: ["updatedBy"];+ isOneToOne: false;+ referencedRelation: "userDefaults";+ referencedColumns: ["userId"];+ }+ ];+ };supplierQuotes: {Row: {assignee: string | null;diff --git a/packages/database/supabase/migrations/20241202192419_supplier-quotes.sql b/packages/database/supabase/migrations/20241202192419_supplier-quotes.sqlindex 47e6b49691..fa3245cb31 100644--- a/packages/database/supabase/migrations/20241202192419_supplier-quotes.sql+++ b/packages/database/supabase/migrations/20241202192419_supplier-quotes.sql@@ -161,8 +161,7 @@ CREATE POLICY "Users can delete their own supplier quote favorites" ON "supplier);DROP VIEW IF EXISTS "supplierQuotes";-CREATE OR REPLACE VIEW- "supplierQuotes"+CREATE OR REPLACE VIEW "supplierQuotes"WITH(SECURITY_INVOKER = true) ASSELECT@@ -201,4 +200,16 @@ FROMALTER TABLE "purchaseOrder" ADD COLUMN "internalNotes" JSON DEFAULT '{}'::JSON;ALTER TABLE "purchaseOrder" ADD COLUMN "externalNotes" JSON DEFAULT '{}'::JSON;-ALTER TABLE "purchaseOrderLine" ADD COLUMN "notes" JSON DEFAULT '{}'::JSON;\ No newline at end of file+ALTER TABLE "purchaseOrderLine" ADD COLUMN "notes" JSON DEFAULT '{}'::JSON;+++DROP VIEW IF EXISTS "supplierQuoteLines";+CREATE OR REPLACE VIEW "supplierQuoteLines" WITH(SECURITY_INVOKER=true) AS (+ SELECT+ ql.*,+ i."thumbnailPath",+ ic."unitCost" as "unitCost"+ FROM "supplierQuoteLine" ql+ INNER JOIN "item" i ON i.id = ql."itemId"+ LEFT JOIN "itemCost" ic ON ic."itemId" = i.id+);