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.

feat: prototype BoM tree

Brad Barbine08be6ae2fff
diff --git a/apps/carbon/app/routes/x+/customer+/new.tsx b/apps/carbon/app/routes/x+/customer+/new.tsx
index e88bbdf72f..21f4edb81f 100644
--- a/apps/carbon/app/routes/x+/customer+/new.tsx
+++ b/apps/carbon/app/routes/x+/customer+/new.tsx
@@ -64,7 +64,7 @@ export default function CustomersNewRoute() {
name: "",
};
return (
- <div className="w-1/2 max-w-[720px] min-w-[420px] mx-auto">
+ <div className="w-1/2 max-w-[600px] min-w-[420px] mx-auto">
<CustomerForm initialValues={initialValues} />
</div>
);
diff --git a/apps/carbon/app/routes/x+/item+/index.tsx b/apps/carbon/app/routes/x+/item+/index.tsx
new file mode 100644
index 0000000000..4ce7599dd7
--- /dev/null
+++ b/apps/carbon/app/routes/x+/item+/index.tsx
@@ -0,0 +1,374 @@
+import {
+ Badge,
+ ClientOnly,
+ Enumerable,
+ HStack,
+ Heading,
+ ResizableHandle,
+ ResizablePanel,
+ ResizablePanelGroup,
+ cn,
+} from "@carbon/react";
+import { Link, type LinkProps } from "@remix-run/react";
+import { TreeView, useTree } from "~/components/TreeView/TreeView";
+
+import type { LoaderFunctionArgs } from "@remix-run/node";
+import { useRef, useState } from "react";
+import { AiOutlinePartition } from "react-icons/ai";
+import { FaCodePullRequest } from "react-icons/fa6";
+import { HiSquares2X2 } from "react-icons/hi2";
+import {
+ LuChevronDown,
+ LuChevronUp,
+ LuHammer,
+ LuShoppingCart,
+} from "react-icons/lu";
+import { typedjson, useTypedLoaderData } from "remix-typedjson";
+
+type Method = {
+ id: string;
+ parentId: string | undefined;
+ children: string[];
+ hasChildren: boolean;
+ level: number;
+ data: {
+ itemId: string;
+ readableId: string;
+ description: string;
+ quantity: number;
+ fulfillmentMethod: "Buy" | "Make" | "Pick";
+ isInherited: boolean;
+ isRoot: boolean;
+ };
+};
+
+export async function loader({ request }: LoaderFunctionArgs) {
+ return typedjson({
+ methods: [
+ {
+ id: "1",
+ parentId: undefined,
+ hasChildren: true,
+ children: ["2", "3"],
+ level: 0,
+ data: {
+ itemId: "1",
+ readableId: "F02134",
+ description: '1/2" x 3" x 4" Bracket',
+ quantity: 1,
+ fulfillmentMethod: "Make",
+ isInherited: false,
+ isRoot: true,
+ },
+ },
+ {
+ id: "2",
+ parentId: "1",
+ hasChildren: true,
+ children: ["4"],
+ level: 1,
+ data: {
+ itemId: "2",
+ readableId: "F501932",
+ description: '1/2" x 3" x 4" Cutout',
+ quantity: 1,
+ fulfillmentMethod: "Make",
+ isInherited: false,
+ isRoot: false,
+ },
+ },
+ {
+ id: "4",
+ parentId: "2",
+ hasChildren: false,
+ children: [],
+ level: 2,
+ data: {
+ itemId: "4",
+ readableId: "F41858",
+ description: "1/8 X 5/8 6061-T6511 Aluminum Flat",
+ quantity: 2.8,
+ fulfillmentMethod: "Pick",
+ isInherited: true,
+ isRoot: false,
+ },
+ },
+ ] satisfies Method[],
+ });
+}
+
+export default function Item() {
+ const { methods } = useTypedLoaderData<typeof loader>();
+
+ return (
+ <div className="flex flex-col w-full h-full">
+ <div className="flex flex-shrink-0 items-center justify-between px-4 py-2 bg-card border-b border-border">
+ <div className="flex flex-col flex-grow">
+ <HStack>
+ <Heading size="h2">F02134</Heading>
+ <Enumerable value="Part" />
+ </HStack>
+ <p className="text-sm text-muted-foreground">
+ 1/2" x 3" x 4" Bracket
+ </p>
+ </div>
+ <div className="flex flex-col flex-shrink justify-center items-end">
+ <Tabs>
+ <TabTrigger to="details">Details</TabTrigger>
+ <TabTrigger to="purchasing">Purchasing</TabTrigger>
+ <TabTrigger to="sales">Sales</TabTrigger>
+ <TabTrigger isActive to="production">
+ Production
+ </TabTrigger>
+ <TabTrigger to="inventory">Inventory</TabTrigger>
+ </Tabs>
+ </div>
+ </div>
+ <div className="flex flex-grow overflow-hidden">
+ <ClientOnly fallback={null}>
+ {() => (
+ <ResizablePanelGroup direction="horizontal">
+ {/* Tree list */}
+ <ResizablePanel
+ order={1}
+ minSize={20}
+ defaultSize={20}
+ className="bg-card"
+ >
+ <div className="grid h-full overflow-hidden p-2">
+ <BoMExplorer
+ methods={methods}
+ onSelectedIdChanged={(selectedId) => {
+ console.log(selectedId);
+ }}
+ />
+ </div>
+ </ResizablePanel>
+ <ResizableHandle withHandle />
+
+ <ResizablePanel order={2} minSize={40} defaultSize={60}>
+ {/* Details */}
+ </ResizablePanel>
+ <ResizableHandle withHandle />
+ <ResizablePanel
+ order={3}
+ minSize={20}
+ defaultSize={20}
+ className="bg-card"
+ >
+ <div className="grid h-full overflow-hidden p-2"></div>
+ </ResizablePanel>
+ </ResizablePanelGroup>
+ )}
+ </ClientOnly>
+ </div>
+ </div>
+ );
+}
+
+type BoMExplorerProps = {
+ methods: Method[];
+ selectedId?: string;
+ onSelectedIdChanged: (selectedId: string | undefined) => void;
+};
+
+function BoMExplorer({
+ methods,
+ selectedId,
+ onSelectedIdChanged,
+}: BoMExplorerProps) {
+ const [filterText, setFilterText] = useState("");
+ const parentRef = useRef<HTMLDivElement>(null);
+
+ const {
+ nodes,
+ getTreeProps,
+ getNodeProps,
+ toggleNodeSelection,
+ toggleExpandNode,
+ expandAllBelowDepth,
+ toggleExpandLevel,
+ collapseAllBelowDepth,
+ selectNode,
+ scrollToNode,
+ virtualizer,
+ } = useTree({
+ tree: methods,
+ selectedId,
+ // collapsedIds,
+ onSelectedIdChanged,
+ estimatedRowHeight: () => 32,
+ parentRef,
+ filter: {
+ value: { text: filterText },
+ fn: (value, node) => {
+ if (value.text === "") return true;
+ // if (
+ // node.data.partId.toLowerCase().includes(value.text.toLowerCase())
+ // ) {
+ // return true;
+ // }
+ return false;
+ },
+ },
+ });
+
+ return (
+ <TreeView
+ parentRef={parentRef}
+ virtualizer={virtualizer}
+ autoFocus
+ tree={methods}
+ nodes={nodes}
+ getNodeProps={getNodeProps}
+ getTreeProps={getTreeProps}
+ renderNode={({ node, state }) => (
+ <>
+ <div
+ className={cn(
+ "flex h-8 cursor-pointer items-center overflow-hidden rounded-sm pr-2",
+ state.selected
+ ? "bg-muted hover:bg-muted/90"
+ : "bg-transparent hover:bg-muted/90"
+ )}
+ onClick={() => {
+ selectNode(node.id);
+ }}
+ >
+ <div className="flex h-8 items-center">
+ {Array.from({ length: node.level }).map((_, index) => (
+ <TaskLine key={index} isSelected={state.selected} />
+ ))}
+ <div
+ className={cn(
+ "flex h-8 w-4 items-center",
+ node.hasChildren && "hover:bg-accent"
+ )}
+ onClick={(e) => {
+ e.stopPropagation();
+ if (e.altKey) {
+ if (state.expanded) {
+ collapseAllBelowDepth(node.level);
+ } else {
+ expandAllBelowDepth(node.level);
+ }
+ } else {
+ toggleExpandNode(node.id);
+ }
+ scrollToNode(node.id);
+ }}
+ >
+ {node.hasChildren ? (
+ state.expanded ? (
+ <LuChevronDown className="h-4 w-4 text-gray-400" />
+ ) : (
+ <LuChevronUp className="h-4 w-4 text-gray-400" />
+ )
+ ) : (
+ <div className="h-8 w-4" />
+ )}
+ </div>
+ </div>
+
+ <div className="flex w-full items-center justify-between gap-2">
+ <div
+ className={cn(
+ "flex items-center gap-2 overflow-x-hidden",
+ node.data.isInherited && "opacity-50"
+ )}
+ >
+ <MethodIcon
+ type={
+ // node.data.isRoot ? "Method" :
+ node.data.fulfillmentMethod
+ }
+ className="h-4 min-h-4 w-4 min-w-4"
+ />
+ <NodeText node={node} />
+ </div>
+ <div className="flex items-center gap-1">
+ {node.data.isRoot ? (
+ <Badge variant="outline" className="text-xs">
+ Method
+ </Badge>
+ ) : (
+ <NodeQuantity node={node} />
+ )}
+ </div>
+ </div>
+ </div>
+ </>
+ )}
+ />
+ );
+}
+
+function MethodIcon({ type, className }: { type: string; className?: string }) {
+ switch (type) {
+ case "Method":
+ return (
+ <AiOutlinePartition className={cn(className, "text-foreground")} />
+ );
+ case "Buy":
+ return <LuShoppingCart className={cn(className, "text-blue-500")} />;
+ case "Make":
+ return <LuHammer className={cn(className, "text-green-500")} />;
+ case "Pick":
+ return <FaCodePullRequest className={cn(className, "text-yellow-500")} />;
+ }
+
+ return <HiSquares2X2 className={cn(className, "text-muted-foreground")} />;
+}
+
+function NodeText({ node }: { node: Method }) {
+ return (
+ <div className="flex items-center gap-1">
+ <span className="text-sm font-mono">{node.data.readableId}</span>
+ </div>
+ );
+}
+
+function NodeQuantity({ node }: { node: Method }) {
+ return (
+ <Badge className="text-xs" variant="outline">
+ {node.data.quantity}
+ </Badge>
+ );
+}
+
+function TaskLine({ isSelected }: { isSelected: boolean }) {
+ return (
+ <div
+ className={cn(
+ "h-8 w-2 border-r border-border",
+ isSelected && "border-foreground/30"
+ )}
+ />
+ );
+}
+
+function Tabs({ children }: { children?: React.ReactNode }) {
+ return (
+ <div className="inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground">
+ {children}
+ </div>
+ );
+}
+
+function TabTrigger({
+ children,
+ isActive,
+ ...props
+}: LinkProps & { isActive?: boolean }) {
+ return (
+ <Link
+ {...props}
+ className={cn(
+ "inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
+ isActive && "bg-background text-foreground shadow"
+ )}
+ >
+ {children}
+ </Link>
+ );
+}
diff --git a/apps/carbon/app/routes/x+/part+/new.tsx b/apps/carbon/app/routes/x+/part+/new.tsx
index fba346901c..3a933eff2c 100644
--- a/apps/carbon/app/routes/x+/part+/new.tsx
+++ b/apps/carbon/app/routes/x+/part+/new.tsx
@@ -64,7 +64,7 @@ export default function PartsNewRoute() {
};
return (
- <div className="w-1/2 max-w-[720px] min-w-[420px] mx-auto">
+ <div className="w-1/2 max-w-[600px] min-w-[420px] mx-auto">
<PartForm initialValues={initialValues} />
</div>
);
diff --git a/apps/carbon/app/routes/x+/purchase-invoice+/new.tsx b/apps/carbon/app/routes/x+/purchase-invoice+/new.tsx
index 2ab9b61f22..4ae85552b7 100644
--- a/apps/carbon/app/routes/x+/purchase-invoice+/new.tsx
+++ b/apps/carbon/app/routes/x+/purchase-invoice+/new.tsx
@@ -129,7 +129,7 @@ export default function PurchaseInvoiceNewRoute() {
};
return (
- <div className="w-1/2 max-w-[720px] min-w-[420px] mx-auto">
+ <div className="w-1/2 max-w-[600px] min-w-[420px] mx-auto">
<PurchaseInvoiceForm
initialValues={initialValues}
paymentTerms={sharedData?.paymentTerms ?? []}
diff --git a/apps/carbon/app/routes/x+/purchase-order+/new.tsx b/apps/carbon/app/routes/x+/purchase-order+/new.tsx
index 5718d7f68a..af5d48dd19 100644
--- a/apps/carbon/app/routes/x+/purchase-order+/new.tsx
+++ b/apps/carbon/app/routes/x+/purchase-order+/new.tsx
@@ -86,7 +86,7 @@ export default function PurchaseOrderNewRoute() {
};
return (
- <div className="w-1/2 max-w-[720px] min-w-[420px] mx-auto">
+ <div className="w-1/2 max-w-[600px] min-w-[420px] mx-auto">
<PurchaseOrderForm initialValues={initialValues} />
</div>
);
diff --git a/apps/carbon/app/routes/x+/quote+/new.tsx b/apps/carbon/app/routes/x+/quote+/new.tsx
index 3b65d5b00d..adff3e4c39 100644
--- a/apps/carbon/app/routes/x+/quote+/new.tsx
+++ b/apps/carbon/app/routes/x+/quote+/new.tsx
@@ -73,7 +73,7 @@ export default function QuotationNewRoute() {
};
return (
- <div className="w-1/2 max-w-[720px] min-w-[420px] mx-auto pt-4">
+ <div className="w-1/2 max-w-[600px] min-w-[420px] mx-auto pt-4">
{/* @ts-ignore */}
<QuotationForm initialValues={initialValues} />
</div>
diff --git a/apps/carbon/app/routes/x+/rfq+/new.tsx b/apps/carbon/app/routes/x+/rfq+/new.tsx
index ea5f8d059c..fa71642004 100644
--- a/apps/carbon/app/routes/x+/rfq+/new.tsx
+++ b/apps/carbon/app/routes/x+/rfq+/new.tsx
@@ -78,7 +78,7 @@ export default function RequestForQuoteNewRoute() {
};
return (
- <div className="w-1/2 max-w-[720px] min-w-[420px] mx-auto">
+ <div className="w-1/2 max-w-[600px] min-w-[420px] mx-auto">
<RequestForQuoteForm initialValues={initialValues} />
</div>
);
diff --git a/apps/carbon/app/routes/x+/sales-order+/new.tsx b/apps/carbon/app/routes/x+/sales-order+/new.tsx
index f492b79888..5f16291c1c 100644
--- a/apps/carbon/app/routes/x+/sales-order+/new.tsx
+++ b/apps/carbon/app/routes/x+/sales-order+/new.tsx
@@ -80,7 +80,7 @@ export default function SalesOrderNewRoute() {
};
return (
- <div className="w-1/2 max-w-[720px] min-w-[420px] mx-auto">
+ <div className="w-1/2 max-w-[600px] min-w-[420px] mx-auto">
<SalesOrderForm initialValues={initialValues} />
</div>
);
diff --git a/apps/carbon/app/routes/x+/service+/new.tsx b/apps/carbon/app/routes/x+/service+/new.tsx
index bdf7d1821a..d533d785dc 100644
--- a/apps/carbon/app/routes/x+/service+/new.tsx
+++ b/apps/carbon/app/routes/x+/service+/new.tsx
@@ -67,7 +67,7 @@ export default function ServiceNewRoute() {
};
return (
- <div className="w-1/2 max-w-[720px] min-w-[420px] mx-auto">
+ <div className="w-1/2 max-w-[600px] min-w-[420px] mx-auto">
{/* @ts-ignore */}
<ServiceForm initialValues={initialValues} />
</div>
diff --git a/apps/carbon/app/routes/x+/supplier+/new.tsx b/apps/carbon/app/routes/x+/supplier+/new.tsx
index 4395c20414..db05808425 100644
--- a/apps/carbon/app/routes/x+/supplier+/new.tsx
+++ b/apps/carbon/app/routes/x+/supplier+/new.tsx
@@ -64,7 +64,7 @@ export default function SuppliersNewRoute() {
name: "",
};
return (
- <div className="w-1/2 max-w-[720px] min-w-[420px] mx-auto">
+ <div className="w-1/2 max-w-[600px] min-w-[420px] mx-auto">
<SupplierForm initialValues={initialValues} />
</div>
);
diff --git a/apps/mes/index.html b/apps/mes/index.html
index 876ec45862..91efd1a283 100644
--- a/apps/mes/index.html
+++ b/apps/mes/index.html
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>CarbonOS - MES</title>
</head>
- <body>
+ <body class="bg-background dark">
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
diff --git a/apps/mes/src/routes/job.tsx b/apps/mes/src/routes/job.tsx
index 650632f8c2..2f3aefa992 100644
--- a/apps/mes/src/routes/job.tsx
+++ b/apps/mes/src/routes/job.tsx
@@ -359,6 +359,32 @@ export function Job() {
<Separator />
</>
)}
+ <div className="flex flex-col items-start justify-between">
+ <div className="p-4">
+ <Heading size="h3">Materials</Heading>
+ </div>
+ <Table>
+ <Thead>
+ <Tr>
+ <Th>Part</Th>
+ <Th>Quantity</Th>
+
+ <Th></Th>
+ </Tr>
+ </Thead>
+ <Tbody>
+ <Tr>
+ <Td
+ colSpan={24}
+ className="py-8 text-muted-foreground text-center"
+ >
+ No materials
+ </Td>
+ </Tr>
+ </Tbody>
+ </Table>
+ </div>
+ <Separator />
<div className="flex flex-col items-start justify-between">
<div className="p-4">
<Heading size="h3">Files</Heading>
@@ -539,7 +565,7 @@ function Notes({ notes }: { job: JobType; notes: Note[] }) {
<div className="flex-grow relative">
<input
type="text"
- className="flex w-full border rounded-xl focus:outline-none focus:border-ring pl-4 h-11"
+ className="flex w-full border rounded-xl focus:outline-none focus:border-ring pl-4 h-11 bg-foreground/10 text-foreground"
/>
{/* <button className="absolute flex items-center justify-center h-full w-12 right-0 top-0 text-gray-400 hover:text-gray-600">
<svg
diff --git a/apps/mes/src/routes/jobs.tsx b/apps/mes/src/routes/jobs.tsx
index 9999149bad..5014d2e94c 100644
--- a/apps/mes/src/routes/jobs.tsx
+++ b/apps/mes/src/routes/jobs.tsx
@@ -206,7 +206,7 @@ export function Jobs({
</TabsList>
</div>
<Separator />
- <div className="bg-background/95 p-4 backdrop-blur supports-[backdrop-filter]:bg-background/60">
+ <div className="p-4">
<div className="relative">
<div className="flex justify-between space-x-4">
<div className="flex flex-grow">
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 8b812a7a4a..c18e725cc6 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -20433,14 +20433,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["supplierCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["id"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["supplierCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["id"]
@@ -23227,6 +23227,101 @@ export type Database = {
},
]
}
+ s3_multipart_uploads: {
+ Row: {
+ bucket_id: string
+ created_at: string
+ id: string
+ in_progress_size: number
+ key: string
+ owner_id: string | null
+ upload_signature: string
+ version: string
+ }
+ Insert: {
+ bucket_id: string
+ created_at?: string
+ id: string
+ in_progress_size?: number
+ key: string
+ owner_id?: string | null
+ upload_signature: string
+ version: string
+ }
+ Update: {
+ bucket_id?: string
+ created_at?: string
+ id?: string
+ in_progress_size?: number
+ key?: string
+ owner_id?: string | null
+ upload_signature?: string
+ version?: string
+ }
+ Relationships: [
+ {
+ foreignKeyName: "s3_multipart_uploads_bucket_id_fkey"
+ columns: ["bucket_id"]
+ isOneToOne: false
+ referencedRelation: "buckets"
+ referencedColumns: ["id"]
+ },
+ ]
+ }
+ s3_multipart_uploads_parts: {
+ Row: {
+ bucket_id: string
+ created_at: string
+ etag: string
+ id: string
+ key: string
+ owner_id: string | null
+ part_number: number
+ size: number
+ upload_id: string
+ version: string
+ }
+ Insert: {
+ bucket_id: string
+ created_at?: string
+ etag: string
+ id?: string
+ key: string
+ owner_id?: string | null
+ part_number: number
+ size?: number
+ upload_id: string
+ version: string
+ }
+ Update: {
+ bucket_id?: string
+ created_at?: string
+ etag?: string
+ id?: string
+ key?: string
+ owner_id?: string | null
+ part_number?: number
+ size?: number
+ upload_id?: string
+ version?: string
+ }
+ Relationships: [
+ {
+ foreignKeyName: "s3_multipart_uploads_parts_bucket_id_fkey"
+ columns: ["bucket_id"]
+ isOneToOne: false
+ referencedRelation: "buckets"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "s3_multipart_uploads_parts_upload_id_fkey"
+ columns: ["upload_id"]
+ isOneToOne: false
+ referencedRelation: "s3_multipart_uploads"
+ referencedColumns: ["id"]
+ },
+ ]
+ }
}
Views: {
[_ in never]: never
@@ -23266,6 +23361,37 @@ export type Database = {
bucket_id: string
}[]
}
+ list_multipart_uploads_with_delimiter: {
+ Args: {
+ bucket_id: string
+ prefix_param: string
+ delimiter_param: string
+ max_keys?: number
+ next_key_token?: string
+ next_upload_token?: string
+ }
+ Returns: {
+ key: string
+ id: string
+ created_at: string
+ }[]
+ }
+ list_objects_with_delimiter: {
+ Args: {
+ bucket_id: string
+ prefix_param: string
+ delimiter_param: string
+ max_keys?: number
+ start_after?: string
+ next_token?: string
+ }
+ Returns: {
+ name: string
+ id: string
+ metadata: Json
+ updated_at: string
+ }[]
+ }
search: {
Args: {
prefix: string
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 8b812a7a4a..c18e725cc6 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -20433,14 +20433,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["supplierCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["id"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["supplierCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["id"]
@@ -23227,6 +23227,101 @@ export type Database = {
},
]
}
+ s3_multipart_uploads: {
+ Row: {
+ bucket_id: string
+ created_at: string
+ id: string
+ in_progress_size: number
+ key: string
+ owner_id: string | null
+ upload_signature: string
+ version: string
+ }
+ Insert: {
+ bucket_id: string
+ created_at?: string
+ id: string
+ in_progress_size?: number
+ key: string
+ owner_id?: string | null
+ upload_signature: string
+ version: string
+ }
+ Update: {
+ bucket_id?: string
+ created_at?: string
+ id?: string
+ in_progress_size?: number
+ key?: string
+ owner_id?: string | null
+ upload_signature?: string
+ version?: string
+ }
+ Relationships: [
+ {
+ foreignKeyName: "s3_multipart_uploads_bucket_id_fkey"
+ columns: ["bucket_id"]
+ isOneToOne: false
+ referencedRelation: "buckets"
+ referencedColumns: ["id"]
+ },
+ ]
+ }
+ s3_multipart_uploads_parts: {
+ Row: {
+ bucket_id: string
+ created_at: string
+ etag: string
+ id: string
+ key: string
+ owner_id: string | null
+ part_number: number
+ size: number
+ upload_id: string
+ version: string
+ }
+ Insert: {
+ bucket_id: string
+ created_at?: string
+ etag: string
+ id?: string
+ key: string
+ owner_id?: string | null
+ part_number: number
+ size?: number
+ upload_id: string
+ version: string
+ }
+ Update: {
+ bucket_id?: string
+ created_at?: string
+ etag?: string
+ id?: string
+ key?: string
+ owner_id?: string | null
+ part_number?: number
+ size?: number
+ upload_id?: string
+ version?: string
+ }
+ Relationships: [
+ {
+ foreignKeyName: "s3_multipart_uploads_parts_bucket_id_fkey"
+ columns: ["bucket_id"]
+ isOneToOne: false
+ referencedRelation: "buckets"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "s3_multipart_uploads_parts_upload_id_fkey"
+ columns: ["upload_id"]
+ isOneToOne: false
+ referencedRelation: "s3_multipart_uploads"
+ referencedColumns: ["id"]
+ },
+ ]
+ }
}
Views: {
[_ in never]: never
@@ -23266,6 +23361,37 @@ export type Database = {
bucket_id: string
}[]
}
+ list_multipart_uploads_with_delimiter: {
+ Args: {
+ bucket_id: string
+ prefix_param: string
+ delimiter_param: string
+ max_keys?: number
+ next_key_token?: string
+ next_upload_token?: string
+ }
+ Returns: {
+ key: string
+ id: string
+ created_at: string
+ }[]
+ }
+ list_objects_with_delimiter: {
+ Args: {
+ bucket_id: string
+ prefix_param: string
+ delimiter_param: string
+ max_keys?: number
+ start_after?: string
+ next_token?: string
+ }
+ Returns: {
+ name: string
+ id: string
+ metadata: Json
+ updated_at: string
+ }[]
+ }
search: {
Args: {
prefix: string
diff --git a/packages/database/supabase/migrations/20230330024715_accounts.sql b/packages/database/supabase/migrations/20230330024715_accounts.sql
index b73671ddaf..296f13b768 100644
--- a/packages/database/supabase/migrations/20230330024715_accounts.sql
+++ b/packages/database/supabase/migrations/20230330024715_accounts.sql
@@ -108,7 +108,7 @@ CREATE TABLE "accountCategory" (
CONSTRAINT "accountCategory_pkey" PRIMARY KEY ("id"),
CONSTRAINT "accountCategory_unique_category" UNIQUE ("category", "companyId"),
- CONSTRAINT "accountCategory_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company"("id"),
+ CONSTRAINT "accountCategory_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company"("id") ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT "accountCategory_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user"("id"),
CONSTRAINT "accountCategory_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user"("id")
);