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: add attachments to cusotmer portals

Brad Barbind327ff9ec327
diff --git a/apps/erp/app/modules/production/production.service.ts b/apps/erp/app/modules/production/production.service.ts
index 632087e63d..0d7370971a 100644
--- a/apps/erp/app/modules/production/production.service.ts
+++ b/apps/erp/app/modules/production/production.service.ts
@@ -186,6 +186,17 @@ export async function getJob(client: SupabaseClient<Database>, id: string) {
return client.from("jobs").select("*").eq("id", id).single();
}
+export async function getJobByOperationId(
+ client: SupabaseClient<Database>,
+ operationId: string
+) {
+ return client
+ .from("jobOperation")
+ .select("...job(id, companyId, customerId)")
+ .eq("id", operationId)
+ .single();
+}
+
export async function getJobPurchaseOrderLines(
client: SupabaseClient<Database>,
jobId: string
@@ -453,6 +464,37 @@ export async function getJobOperationsAssignedToEmployee(
.eq("companyId", companyId);
}
+export async function getJobOperationAttachments(
+ client: SupabaseClient<Database>,
+ jobOperationIds: string[]
+): Promise<Record<string, string[]>> {
+ if (jobOperationIds.length === 0) return {};
+
+ const { data: operationAttributes } = await client
+ .from("jobOperationAttribute")
+ .select("*, jobOperationAttributeRecord(*)")
+ .in("operationId", jobOperationIds);
+
+ if (!operationAttributes) return {};
+
+ const attachmentsByOperation: Record<string, string[]> = {};
+
+ operationAttributes.forEach((attr) => {
+ if (attr.jobOperationAttributeRecord) {
+ if (attr.type === "File" && attr.jobOperationAttributeRecord?.value) {
+ if (!attachmentsByOperation[attr.operationId]) {
+ attachmentsByOperation[attr.operationId] = [];
+ }
+ attachmentsByOperation[attr.operationId].push(
+ attr.jobOperationAttributeRecord?.value
+ );
+ }
+ }
+ });
+
+ return attachmentsByOperation;
+}
+
export async function getJobOperationsList(
client: SupabaseClient<Database>,
jobId: string
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx b/apps/erp/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx
index 47ae34f26c..5137babb21 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobBillOfMaterial.tsx
@@ -684,7 +684,7 @@ function MaterialForm({
return;
}
- const [item, itemCost] = await await Promise.all([
+ const [item, itemCost] = await Promise.all([
carbon
.from("item")
.select(
diff --git a/apps/erp/app/modules/production/ui/Jobs/JobMaterialForm.tsx b/apps/erp/app/modules/production/ui/Jobs/JobMaterialForm.tsx
index 80d9d86eed..7e37f80a7f 100644
--- a/apps/erp/app/modules/production/ui/Jobs/JobMaterialForm.tsx
+++ b/apps/erp/app/modules/production/ui/Jobs/JobMaterialForm.tsx
@@ -100,7 +100,7 @@ const JobMaterialForm = ({
const onItemChange = async (itemId: string) => {
if (!carbon) return;
- const [item, itemCost] = await await Promise.all([
+ const [item, itemCost] = await Promise.all([
carbon
.from("item")
.select(
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
index 058eb81d4f..f8de6baed4 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfMaterial.tsx
@@ -670,7 +670,7 @@ function MaterialForm({
return;
}
- const [item, itemCost] = await await Promise.all([
+ const [item, itemCost] = await Promise.all([
carbon
.from("item")
.select(
diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteMaterialForm.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteMaterialForm.tsx
index 936a0f9669..8f1c632341 100644
--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteMaterialForm.tsx
+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteMaterialForm.tsx
@@ -98,7 +98,7 @@ const QuoteMaterialForm = ({
const onItemChange = async (itemId: string) => {
if (!carbon) return;
- const [item, itemCost] = await await Promise.all([
+ const [item, itemCost] = await Promise.all([
carbon
.from("item")
.select(
diff --git a/apps/erp/app/routes/share+/customer.$id.$.tsx b/apps/erp/app/routes/share+/customer.$id.$.tsx
new file mode 100644
index 0000000000..147c3172fc
--- /dev/null
+++ b/apps/erp/app/routes/share+/customer.$id.$.tsx
@@ -0,0 +1,144 @@
+import { getCarbonServiceRole } from "@carbon/auth";
+import { redis } from "@carbon/kv";
+import { supportedModelTypes } from "@carbon/react";
+import { Ratelimit } from "@upstash/ratelimit";
+import { type LoaderFunctionArgs } from "@vercel/remix";
+import { getJobByOperationId } from "~/modules/production";
+import { getCustomerPortal } from "~/modules/shared/shared.service";
+
+const supportedFileTypes: Record<string, string> = {
+ pdf: "application/pdf",
+ jpg: "image/jpeg",
+ jpeg: "image/jpeg",
+ png: "image/png",
+ gif: "image/gif",
+ svg: "image/svg+xml",
+ avif: "image/avif",
+ webp: "image/webp",
+ mp4: "video/mp4",
+ webm: "video/webm",
+ mov: "video/quicktime",
+ avi: "video/x-msvideo",
+ wmv: "video/x-ms-wmv",
+ mp3: "audio/mpeg",
+ wav: "audio/wav",
+ ogg: "audio/ogg",
+ flac: "audio/flac",
+ dxf: "application/dxf",
+ dwg: "application/dxf",
+ stl: "application/stl",
+ obj: "application/obj",
+ glb: "application/glb",
+ gltf: "application/gltf",
+ fbx: "application/fbx",
+ ply: "application/ply",
+ off: "application/off",
+ step: "application/step",
+};
+
+const ratelimit = new Ratelimit({
+ redis,
+ limiter: Ratelimit.slidingWindow(10, "1 m"), // 10 downloads per minute
+ analytics: true,
+});
+
+export let loader = async ({ params, request }: LoaderFunctionArgs) => {
+ const { id } = params;
+ if (!id) {
+ throw new Error("Customer ID is required");
+ }
+
+ const ip = request.headers.get("x-forwarded-for") ?? "127.0.0.1";
+
+ const { success } = await ratelimit.limit(ip);
+
+ if (!success) {
+ return new Response(null, { status: 429 });
+ }
+
+ const serviceRole = getCarbonServiceRole();
+ const customer = await getCustomerPortal(serviceRole, id);
+
+ if (customer.error) {
+ console.error(customer.error);
+ throw new Error("Customer not found");
+ }
+
+ if (!customer.data.customerId) {
+ console.error(customer.error);
+ throw new Error("Customer not found");
+ }
+
+ let path = params["*"];
+ let bucket = "private"; // TODO: refactor to use companyId when we separate the storage buckets
+
+ if (!path) throw new Error("Path not found");
+
+ path = decodeURIComponent(path);
+
+ const pathMatch = params["*"]?.match(/^([^/]+)\/job\/([^/]+)\/[^/]+$/);
+ const companyId = pathMatch?.[1];
+ const operationId = pathMatch?.[2];
+
+ const fileType = path.split(".").pop()?.toLowerCase();
+
+ if (companyId !== customer.data.companyId) {
+ return new Response(null, { status: 403 });
+ }
+
+ if (!operationId) {
+ return new Response(null, { status: 403 });
+ }
+
+ const job = await getJobByOperationId(serviceRole, operationId);
+
+ if (job.error) {
+ console.error(job.error);
+ return new Response(null, { status: 403 });
+ }
+
+ if (job.data.companyId !== customer.data.companyId) {
+ return new Response(null, { status: 403 });
+ }
+
+ if (job.data.customerId !== customer.data.customerId) {
+ return new Response(null, { status: 403 });
+ }
+
+ if (
+ !fileType ||
+ (!(fileType in supportedFileTypes) &&
+ !supportedModelTypes.includes(fileType))
+ )
+ throw new Error(`File type ${fileType} not supported`);
+ const contentType = supportedFileTypes[fileType];
+
+ if (!path.includes(customer.data.companyId)) {
+ return new Response(null, { status: 403 });
+ }
+
+ async function downloadFile() {
+ const result = await serviceRole.storage.from(bucket!).download(`${path}`);
+ if (result.error) {
+ console.error(result.error);
+ return null;
+ }
+ return result.data;
+ }
+
+ let fileData = await downloadFile();
+ if (!fileData) {
+ // Wait for a second and try again
+ await new Promise((resolve) => setTimeout(resolve, 1000));
+ fileData = await downloadFile();
+ if (!fileData) {
+ throw new Error("Failed to download file after retry");
+ }
+ }
+
+ const headers = new Headers({
+ "Content-Type": contentType,
+ "Cache-Control": "private, max-age=31536000, immutable",
+ });
+ return new Response(fileData, { status: 200, headers });
+};
diff --git a/apps/erp/app/routes/share+/customer.$id.tsx b/apps/erp/app/routes/share+/customer.$id.tsx
index 33856fce62..3a4374cc58 100644
--- a/apps/erp/app/routes/share+/customer.$id.tsx
+++ b/apps/erp/app/routes/share+/customer.$id.tsx
@@ -1,14 +1,27 @@
import { getCarbonServiceRole } from "@carbon/auth";
import type { Database } from "@carbon/database";
-import { Avatar, cn, Status } from "@carbon/react";
+import {
+ Avatar,
+ cn,
+ HoverCard,
+ HoverCardContent,
+ HoverCardTrigger,
+ Status,
+} from "@carbon/react";
import { formatDate } from "@carbon/utils";
import { useNumberFormatter } from "@react-aria/i18n";
-import { useLoaderData } from "@remix-run/react";
+import { useLoaderData, useParams } from "@remix-run/react";
import type { ColumnDef } from "@tanstack/react-table";
import type { LoaderFunctionArgs } from "@vercel/remix";
-import { json } from "@vercel/remix";
+import { defer } from "@vercel/remix";
import { useMemo } from "react";
-import { LuBookMarked, LuImage, LuShield, LuShieldCheck } from "react-icons/lu";
+import {
+ LuBookMarked,
+ LuImage,
+ LuPaperclip,
+ LuShield,
+ LuShieldCheck,
+} from "react-icons/lu";
import z from "zod";
import {
BreadcrumbItem,
@@ -17,7 +30,10 @@ import {
MethodIcon,
Table,
} from "~/components";
-import { jobOperationStatus } from "~/modules/production";
+import {
+ getJobOperationAttachments,
+ jobOperationStatus,
+} from "~/modules/production";
import { JobStatus } from "~/modules/production/ui/Jobs";
import { getExternalSalesOrderLines } from "~/modules/sales/sales.service";
import { SalesStatus } from "~/modules/sales/ui/SalesOrder";
@@ -36,6 +52,7 @@ export const meta = () => {
const jobOperationValidator = z
.object({
+ id: z.string(),
status: z.enum(jobOperationStatus),
description: z.string(),
order: z.number(),
@@ -90,6 +107,10 @@ export async function loader({ params, request }: LoaderFunctionArgs) {
throw new Error("Sales order lines not found");
}
+ const jobOperationIds = jobOperationValidator
+ .safeParse(salesOrderLines.data?.flatMap((line) => line.jobOperations))
+ .data?.map((operation) => operation.id);
+
const thumbnailPaths = salesOrderLines.data?.reduce<
Record<string, string | null>
>((acc, line) => {
@@ -99,7 +120,7 @@ export async function loader({ params, request }: LoaderFunctionArgs) {
return acc;
}, {});
- const thumbnails: Record<string, string | null> =
+ const [thumbnails, jobOperationAttachments] = await Promise.all([
(thumbnailPaths
? await Promise.all(
Object.entries(thumbnailPaths).map(([id, path]) => {
@@ -120,20 +141,29 @@ export async function loader({ params, request }: LoaderFunctionArgs) {
acc[thumbnail.id] = thumbnail.data;
}
return acc;
- }, {}) ?? {};
+ }, {}) ?? {},
+ getJobOperationAttachments(serviceRole, jobOperationIds ?? []),
+ ]);
- return json({
+ return defer({
customer: customer.data,
company: company.data,
salesOrderLines: salesOrderLines.data ?? [],
+ jobOperationAttachments,
count: salesOrderLines.count,
thumbnails,
});
}
export default function CustomerPortal() {
- const { count, customer, company, salesOrderLines, thumbnails } =
- useLoaderData<typeof loader>();
+ const {
+ count,
+ customer,
+ company,
+ salesOrderLines,
+ thumbnails,
+ jobOperationAttachments,
+ } = useLoaderData<typeof loader>();
const formatter = useNumberFormatter({
minimumFractionDigits: 0,
@@ -295,12 +325,13 @@ export default function CustomerPortal() {
quantityShipped={row.original.quantitySent ?? 0}
quantityComplete={row.original.jobQuantityComplete ?? 0}
jobOperations={jobOperations.data}
+ jobOperationAttachments={jobOperationAttachments}
/>
);
},
},
];
- }, [formatter, thumbnails]);
+ }, [formatter, thumbnails, jobOperationAttachments]);
return (
<div className="flex flex-col h-screen w-screen overflow-hidden bg-background">
@@ -380,11 +411,18 @@ function JobOperationProgress({
quantityShipped,
quantityComplete,
jobOperations,
+ jobOperationAttachments,
}: {
quantityShipped: number;
quantityComplete: number;
jobOperations: z.infer<typeof jobOperationValidator>;
+ jobOperationAttachments: Record<string, string[]>;
}) {
+ const { id } = useParams();
+ if (!id) {
+ throw new Error("Customer ID is required");
+ }
+
const isComplete = quantityShipped > 0 || quantityComplete > 0;
return (
<div className="flex items-center gap-0">
@@ -393,13 +431,15 @@ function JobOperationProgress({
.map((operation, index) => {
const isFirst = index === 0;
const isLast = index === jobOperations.length - 1;
+ const operationId = operation.id;
+ const attachments = jobOperationAttachments[operationId];
return (
<div
key={index}
className={cn(
`
- max-w-[140px]
+ flex items-center gap-1 max-w-[140px]
uppercase font-bold text-[11px] truncate tracking-tight whitespace-nowrap
px-2 py-1
border border-border
@@ -414,6 +454,32 @@ function JobOperationProgress({
)}
>
{operation.description}
+ {Array.isArray(attachments) && attachments.length > 0 && (
+ <HoverCard openDelay={0}>
+ <HoverCardTrigger>
+ <LuPaperclip className="size-3 text-muted-foreground" />
+ </HoverCardTrigger>
+ <HoverCardContent
+ align="end"
+ className="flex flex-col items-end gap-1 text-xs overflow-hidden w-96"
+ >
+ {attachments.map((attachment) => {
+ const fileName = attachment.split("/").pop();
+ return (
+ <div key={attachment}>
+ <a
+ href={path.to.externalCustomerFile(id, attachment)}
+ target="_blank"
+ rel="noreferrer"
+ >
+ {fileName}
+ </a>
+ </div>
+ );
+ })}
+ </HoverCardContent>
+ </HoverCard>
+ )}
</div>
);
})}
diff --git a/apps/erp/app/routes/x+/inventory+/shelves.$id.tsx b/apps/erp/app/routes/x+/inventory+/shelves.$id.tsx
index 98f6d8d05d..bec9c2de52 100644
--- a/apps/erp/app/routes/x+/inventory+/shelves.$id.tsx
+++ b/apps/erp/app/routes/x+/inventory+/shelves.$id.tsx
@@ -54,7 +54,7 @@ export async function clientAction({
}: ClientActionFunctionArgs) {
const companyId = getCompanyId();
- const formData = await await request.clone().formData(); // if we. don't clone it we can't access it in the action
+ const formData = await request.clone().formData(); // if we. don't clone it we can't access it in the action
const validation = await validator(shelfValidator).validate(formData);
if (validation.error) {
diff --git a/apps/erp/app/routes/x+/supplier+/$supplierId.processes.$id.tsx b/apps/erp/app/routes/x+/supplier+/$supplierId.processes.$id.tsx
index 7a7bbaa42d..8c9168d7a9 100644
--- a/apps/erp/app/routes/x+/supplier+/$supplierId.processes.$id.tsx
+++ b/apps/erp/app/routes/x+/supplier+/$supplierId.processes.$id.tsx
@@ -67,7 +67,7 @@ export async function clientAction({
serverAction,
params,
}: ClientActionFunctionArgs) {
- const formData = await await request.clone().formData(); // if we. don't clone it we can't access it in the action
+ const formData = await request.clone().formData(); // if we. don't clone it we can't access it in the action
const validation = await validator(supplierProcessValidator).validate(
formData
);
diff --git a/apps/erp/app/routes/x+/supplier+/$supplierId.processes.new.tsx b/apps/erp/app/routes/x+/supplier+/$supplierId.processes.new.tsx
index 75350c766d..017ef09610 100644
--- a/apps/erp/app/routes/x+/supplier+/$supplierId.processes.new.tsx
+++ b/apps/erp/app/routes/x+/supplier+/$supplierId.processes.new.tsx
@@ -67,7 +67,7 @@ export async function clientAction({
serverAction,
params,
}: ClientActionFunctionArgs) {
- const formData = await await request.clone().formData(); // if we. don't clone it we can't access it in the action
+ const formData = await request.clone().formData(); // if we. don't clone it we can't access it in the action
const validation = await validator(supplierProcessValidator).validate(
formData
);
diff --git a/apps/erp/app/utils/path.ts b/apps/erp/app/utils/path.ts
index 1a6880e041..c1698510aa 100644
--- a/apps/erp/app/utils/path.ts
+++ b/apps/erp/app/utils/path.ts
@@ -629,6 +629,8 @@ export const path = {
generatePath(`${x}/users/employee-types/${id}`),
employeeTypes: `${x}/users/employee-types`,
externalCustomer: (id: string) => generatePath(`/share/customer/${id}`),
+ externalCustomerFile: (id: string, path: string) =>
+ generatePath(`/share/customer/${id}/${path}`),
externalQuote: (id: string) => generatePath(`/share/quote/${id}`),
feedback: `${x}/feedback`,
fiscalYears: `${x}/accounting/years`,
diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.ts
index 18ecc9698f..c604106218 100644
--- a/packages/database/src/swagger-docs-schema.ts
+++ b/packages/database/src/swagger-docs-schema.ts
@@ -3045,6 +3045,117 @@ export default {
tags: ["groups"],
},
},
+ "/qualityActions": {
+ get: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.nonConformanceId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.actionType",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.status",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.dueDate",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.completedDate",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.assignee",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.notes",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.sortOrder",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.tags",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.companyId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.createdAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.createdBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.updatedBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.readableNonConformanceId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.nonConformanceName",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.nonConformanceStatus",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.nonConformanceOpenDate",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.nonConformanceDueDate",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.nonConformanceCloseDate",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.nonConformanceItemId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.qualityActions.nonConformanceTypeName",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/order",
+ },
+ {
+ $ref: "#/parameters/range",
+ },
+ {
+ $ref: "#/parameters/rangeUnit",
+ },
+ {
+ $ref: "#/parameters/offset",
+ },
+ {
+ $ref: "#/parameters/limit",
+ },
+ {
+ $ref: "#/parameters/preferCount",
+ },
+ ],
+ responses: {
+ "200": {
+ description: "OK",
+ schema: {
+ items: {
+ $ref: "#/definitions/qualityActions",
+ },
+ type: "array",
+ },
+ },
+ "206": {
+ description: "Partial Content",
+ },
+ },
+ tags: ["qualityActions"],
+ },
+ },
"/nonConformanceSalesOrderLine": {
get: {
parameters: [
@@ -58814,6 +58925,127 @@ export default {
},
type: "object",
},
+ qualityActions: {
+ properties: {
+ id: {
+ description: "Note:\nThis is a Primary Key.<pk/>",
+ format: "text",
+ type: "string",
+ },
+ nonConformanceId: {
+ description:
+ "Note:\nThis is a Foreign Key to `nonConformance.id`.<fk table='nonConformance' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ actionType: {
+ enum: [
+ "Corrective Action",
+ "Preventive Action",
+ "Containment Action",
+ "Verification",
+ "Customer Communication",
+ ],
+ format: 'public."nonConformanceAction"',
+ type: "string",
+ },
+ status: {
+ enum: ["Pending", "In Progress", "Completed", "Skipped"],
+ format: 'public."nonConformanceTaskStatus"',
+ type: "string",
+ },
+ dueDate: {
+ format: "date",
+ type: "string",
+ },
+ completedDate: {
+ format: "date",
+ type: "string",
+ },
+ assignee: {
+ description:
+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ notes: {
+ format: "json",
+ },
+ sortOrder: {
+ format: "integer",
+ type: "integer",
+ },
+ tags: {
+ format: "text[]",
+ items: {
+ type: "string",
+ },
+ type: "array",
+ },
+ companyId: {
+ description:
+ "Note:\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ createdAt: {
+ format: "timestamp with time zone",
+ type: "string",
+ },
+ createdBy: {
+ description:
+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ updatedAt: {
+ format: "timestamp with time zone",
+ type: "string",
+ },
+ updatedBy: {
+ description:
+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ readableNonConformanceId: {
+ format: "text",
+ type: "string",
+ },
+ nonConformanceName: {
+ format: "text",
+ type: "string",
+ },
+ nonConformanceStatus: {
+ enum: ["Registered", "In Progress", "Closed"],
+ format: 'public."nonConformanceStatus"',
+ type: "string",
+ },
+ nonConformanceOpenDate: {
+ format: "date",
+ type: "string",
+ },
+ nonConformanceDueDate: {
+ format: "date",
+ type: "string",
+ },
+ nonConformanceCloseDate: {
+ format: "date",
+ type: "string",
+ },
+ nonConformanceItemId: {
+ description:
+ "Note:\nThis is a Foreign Key to `item.id`.<fk table='item' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ nonConformanceTypeName: {
+ format: "text",
+ type: "string",
+ },
+ },
+ type: "object",
+ },
nonConformanceSalesOrderLine: {
required: [
"id",
@@ -60803,7 +61035,7 @@ export default {
properties: {
id: {
description:
- "Note:\nThis is a Foreign Key to `supplierLocation.id`.<fk table='supplierLocation' column='id'/>",
+ "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `supplierLocation.id`.<fk table='supplierLocation' column='id'/>",
format: "text",
type: "string",
},
@@ -60852,7 +61084,7 @@ export default {
},
supplierLocationId: {
description:
- "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `supplierLocation.id`.<fk table='supplierLocation' column='id'/>",
+ "Note:\nThis is a Foreign Key to `supplierLocation.id`.<fk table='supplierLocation' column='id'/>",
format: "text",
type: "string",
},
@@ -83806,6 +84038,153 @@ export default {
in: "query",
type: "string",
},
+ "body.qualityActions": {
+ name: "qualityActions",
+ description: "qualityActions",
+ required: false,
+ in: "body",
+ schema: {
+ $ref: "#/definitions/qualityActions",
+ },
+ },
+ "rowFilter.qualityActions.id": {
+ name: "id",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.nonConformanceId": {
+ name: "nonConformanceId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.actionType": {
+ name: "actionType",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.status": {
+ name: "status",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.dueDate": {
+ name: "dueDate",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.completedDate": {
+ name: "completedDate",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.assignee": {
+ name: "assignee",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.notes": {
+ name: "notes",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.sortOrder": {
+ name: "sortOrder",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.tags": {
+ name: "tags",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.companyId": {
+ name: "companyId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.createdAt": {
+ name: "createdAt",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.createdBy": {
+ name: "createdBy",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.updatedAt": {
+ name: "updatedAt",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.updatedBy": {
+ name: "updatedBy",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.readableNonConformanceId": {
+ name: "readableNonConformanceId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.nonConformanceName": {
+ name: "nonConformanceName",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.nonConformanceStatus": {
+ name: "nonConformanceStatus",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.nonConformanceOpenDate": {
+ name: "nonConformanceOpenDate",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.nonConformanceDueDate": {
+ name: "nonConformanceDueDate",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.nonConformanceCloseDate": {
+ name: "nonConformanceCloseDate",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.nonConformanceItemId": {
+ name: "nonConformanceItemId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.qualityActions.nonConformanceTypeName": {
+ name: "nonConformanceTypeName",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.nonConformanceSalesOrderLine": {
name: "nonConformanceSalesOrderLine",
description: "nonConformanceSalesOrderLine",
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 9979f67568..4ed9a4fa20 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -2240,12 +2240,10 @@ export type Database = {
digitalQuoteNotificationGroup: string[]
id: string
inventoryJobCompletedNotificationGroup: string[]
- materialGeneratedIds: boolean
productLabelSize: string | null
rfqReadyNotificationGroup: string[]
salesJobCompletedNotificationGroup: string[]
shelfLabelSize: string | null
- useMetric: boolean
}
Insert: {
digitalQuoteEnabled?: boolean
@@ -2253,12 +2251,10 @@ export type Database = {
digitalQuoteNotificationGroup?: string[]
id: string
inventoryJobCompletedNotificationGroup?: string[]
- materialGeneratedIds?: boolean
productLabelSize?: string | null
rfqReadyNotificationGroup?: string[]
salesJobCompletedNotificationGroup?: string[]
shelfLabelSize?: string | null
- useMetric?: boolean
}
Update: {
digitalQuoteEnabled?: boolean
@@ -2266,12 +2262,10 @@ export type Database = {
digitalQuoteNotificationGroup?: string[]
id?: string
inventoryJobCompletedNotificationGroup?: string[]
- materialGeneratedIds?: boolean
productLabelSize?: string | null
rfqReadyNotificationGroup?: string[]
salesJobCompletedNotificationGroup?: string[]
shelfLabelSize?: string | null
- useMetric?: boolean
}
Relationships: [
{
@@ -11925,10 +11919,10 @@ export type Database = {
createdAt: string
createdBy: string
customFields: Json | null
- dimensionId: string | null
+ dimensions: string | null
externalId: Json | null
- finishId: string | null
- gradeId: string | null
+ finish: string | null
+ grade: string | null
id: string
materialFormId: string | null
materialSubstanceId: string | null
@@ -11943,10 +11937,10 @@ export type Database = {
createdAt?: string
createdBy: string
customFields?: Json | null
- dimensionId?: string | null
+ dimensions?: string | null
externalId?: Json | null
- finishId?: string | null
- gradeId?: string | null
+ finish?: string | null
+ grade?: string | null
id: string
materialFormId?: string | null
materialSubstanceId?: string | null
@@ -11961,10 +11955,10 @@ export type Database = {
createdAt?: string
createdBy?: string
customFields?: Json | null
- dimensionId?: string | null
+ dimensions?: string | null
externalId?: Json | null
- finishId?: string | null
- gradeId?: string | null
+ finish?: string | null
+ grade?: string | null
id?: string
materialFormId?: string | null
materialSubstanceId?: string | null
@@ -12071,48 +12065,6 @@ export type Database = {
referencedRelation: "userDefaults"
referencedColumns: ["userId"]
},
- {
- foreignKeyName: "material_dimensionId_fkey"
- columns: ["dimensionId"]
- isOneToOne: false
- referencedRelation: "materialDimension"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "material_dimensionId_fkey"
- columns: ["dimensionId"]
- isOneToOne: false
- referencedRelation: "materialDimensions"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "material_finishId_fkey"
- columns: ["finishId"]
- isOneToOne: false
- referencedRelation: "materialFinish"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "material_finishId_fkey"
- columns: ["finishId"]
- isOneToOne: false
- referencedRelation: "materialFinishes"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "material_gradeId_fkey"
- columns: ["gradeId"]
- isOneToOne: false
- referencedRelation: "materialGrade"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "material_gradeId_fkey"
- columns: ["gradeId"]
- isOneToOne: false
- referencedRelation: "materialGrades"
- referencedColumns: ["id"]
- },
{
foreignKeyName: "material_materialFormId_fkey"
columns: ["materialFormId"]
@@ -12164,123 +12116,6 @@ export type Database = {
},
]
}
- materialDimension: {
- Row: {
- companyId: string | null
- id: string
- isMetric: boolean
- materialFormId: string
- name: string
- }
- Insert: {
- companyId?: string | null
- id?: string
- isMetric?: boolean
- materialFormId: string
- name: string
- }
- Update: {
- companyId?: string | null
- id?: string
- isMetric?: boolean
- materialFormId?: string
- name?: string
- }
- Relationships: [
- {
- foreignKeyName: "materialDimensions_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "companies"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialDimensions_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "company"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialDimensions_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "customFieldTables"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialDimensions_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "integrations"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialDimensions_materialFormId_fkey"
- columns: ["materialFormId"]
- isOneToOne: false
- referencedRelation: "materialForm"
- referencedColumns: ["id"]
- },
- ]
- }
- materialFinish: {
- Row: {
- companyId: string | null
- id: string
- materialSubstanceId: string
- name: string
- }
- Insert: {
- companyId?: string | null
- id?: string
- materialSubstanceId: string
- name: string
- }
- Update: {
- companyId?: string | null
- id?: string
- materialSubstanceId?: string
- name?: string
- }
- Relationships: [
- {
- foreignKeyName: "materialFinish_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "companies"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialFinish_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "company"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialFinish_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "customFieldTables"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialFinish_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "integrations"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialFinish_materialSubstanceId_fkey"
- columns: ["materialSubstanceId"]
- isOneToOne: false
- referencedRelation: "materialSubstance"
- referencedColumns: ["id"]
- },
- ]
- }
materialForm: {
Row: {
companyId: string | null
@@ -12416,63 +12251,6 @@ export type Database = {
},
]
}
- materialGrade: {
- Row: {
- companyId: string | null
- id: string
- materialSubstanceId: string
- name: string
- }
- Insert: {
- companyId?: string | null
- id?: string
- materialSubstanceId: string
- name: string
- }
- Update: {
- companyId?: string | null
- id?: string
- materialSubstanceId?: string
- name?: string
- }
- Relationships: [
- {
- foreignKeyName: "materialGrade_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "companies"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialGrade_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "company"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialGrade_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "customFieldTables"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialGrade_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "integrations"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialGrade_materialSubstanceId_fkey"
- columns: ["materialSubstanceId"]
- isOneToOne: false
- referencedRelation: "materialSubstance"
- referencedColumns: ["id"]
- },
- ]
- }
materialSubstance: {
Row: {
companyId: string | null
@@ -37854,145 +37632,6 @@ export type Database = {
},
]
}
- materialDimensions: {
- Row: {
- companyId: string | null
- formName: string | null
- id: string | null
- isMetric: boolean | null
- materialFormId: string | null
- name: string | null
- }
- Relationships: [
- {
- foreignKeyName: "materialDimensions_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "companies"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialDimensions_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "company"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialDimensions_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "customFieldTables"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialDimensions_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "integrations"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialDimensions_materialFormId_fkey"
- columns: ["materialFormId"]
- isOneToOne: false
- referencedRelation: "materialForm"
- referencedColumns: ["id"]
- },
- ]
- }
- materialFinishes: {
- Row: {
- companyId: string | null
- id: string | null
- materialSubstanceId: string | null
- name: string | null
- substanceName: string | null
- }
- Relationships: [
- {
- foreignKeyName: "materialFinish_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "companies"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialFinish_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "company"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialFinish_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "customFieldTables"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialFinish_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "integrations"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialFinish_materialSubstanceId_fkey"
- columns: ["materialSubstanceId"]
- isOneToOne: false
- referencedRelation: "materialSubstance"
- referencedColumns: ["id"]
- },
- ]
- }
- materialGrades: {
- Row: {
- companyId: string | null
- id: string | null
- materialSubstanceId: string | null
- name: string | null
- substanceName: string | null
- }
- Relationships: [
- {
- foreignKeyName: "materialGrade_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "companies"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialGrade_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "company"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialGrade_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "customFieldTables"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialGrade_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "integrations"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialGrade_materialSubstanceId_fkey"
- columns: ["materialSubstanceId"]
- isOneToOne: false
- referencedRelation: "materialSubstance"
- referencedColumns: ["id"]
- },
- ]
- }
materials: {
Row: {
active: boolean | null
@@ -38775,14 +38414,14 @@ export type Database = {
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["supplierLocationId"]
+ columns: ["id"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["id"]
+ columns: ["supplierLocationId"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
@@ -40120,14 +39759,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["supplierCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["supplierCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -42576,14 +42215,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["invoiceCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["invoiceCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 9979f67568..4ed9a4fa20 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -2240,12 +2240,10 @@ export type Database = {
digitalQuoteNotificationGroup: string[]
id: string
inventoryJobCompletedNotificationGroup: string[]
- materialGeneratedIds: boolean
productLabelSize: string | null
rfqReadyNotificationGroup: string[]
salesJobCompletedNotificationGroup: string[]
shelfLabelSize: string | null
- useMetric: boolean
}
Insert: {
digitalQuoteEnabled?: boolean
@@ -2253,12 +2251,10 @@ export type Database = {
digitalQuoteNotificationGroup?: string[]
id: string
inventoryJobCompletedNotificationGroup?: string[]
- materialGeneratedIds?: boolean
productLabelSize?: string | null
rfqReadyNotificationGroup?: string[]
salesJobCompletedNotificationGroup?: string[]
shelfLabelSize?: string | null
- useMetric?: boolean
}
Update: {
digitalQuoteEnabled?: boolean
@@ -2266,12 +2262,10 @@ export type Database = {
digitalQuoteNotificationGroup?: string[]
id?: string
inventoryJobCompletedNotificationGroup?: string[]
- materialGeneratedIds?: boolean
productLabelSize?: string | null
rfqReadyNotificationGroup?: string[]
salesJobCompletedNotificationGroup?: string[]
shelfLabelSize?: string | null
- useMetric?: boolean
}
Relationships: [
{
@@ -11925,10 +11919,10 @@ export type Database = {
createdAt: string
createdBy: string
customFields: Json | null
- dimensionId: string | null
+ dimensions: string | null
externalId: Json | null
- finishId: string | null
- gradeId: string | null
+ finish: string | null
+ grade: string | null
id: string
materialFormId: string | null
materialSubstanceId: string | null
@@ -11943,10 +11937,10 @@ export type Database = {
createdAt?: string
createdBy: string
customFields?: Json | null
- dimensionId?: string | null
+ dimensions?: string | null
externalId?: Json | null
- finishId?: string | null
- gradeId?: string | null
+ finish?: string | null
+ grade?: string | null
id: string
materialFormId?: string | null
materialSubstanceId?: string | null
@@ -11961,10 +11955,10 @@ export type Database = {
createdAt?: string
createdBy?: string
customFields?: Json | null
- dimensionId?: string | null
+ dimensions?: string | null
externalId?: Json | null
- finishId?: string | null
- gradeId?: string | null
+ finish?: string | null
+ grade?: string | null
id?: string
materialFormId?: string | null
materialSubstanceId?: string | null
@@ -12071,48 +12065,6 @@ export type Database = {
referencedRelation: "userDefaults"
referencedColumns: ["userId"]
},
- {
- foreignKeyName: "material_dimensionId_fkey"
- columns: ["dimensionId"]
- isOneToOne: false
- referencedRelation: "materialDimension"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "material_dimensionId_fkey"
- columns: ["dimensionId"]
- isOneToOne: false
- referencedRelation: "materialDimensions"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "material_finishId_fkey"
- columns: ["finishId"]
- isOneToOne: false
- referencedRelation: "materialFinish"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "material_finishId_fkey"
- columns: ["finishId"]
- isOneToOne: false
- referencedRelation: "materialFinishes"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "material_gradeId_fkey"
- columns: ["gradeId"]
- isOneToOne: false
- referencedRelation: "materialGrade"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "material_gradeId_fkey"
- columns: ["gradeId"]
- isOneToOne: false
- referencedRelation: "materialGrades"
- referencedColumns: ["id"]
- },
{
foreignKeyName: "material_materialFormId_fkey"
columns: ["materialFormId"]
@@ -12164,123 +12116,6 @@ export type Database = {
},
]
}
- materialDimension: {
- Row: {
- companyId: string | null
- id: string
- isMetric: boolean
- materialFormId: string
- name: string
- }
- Insert: {
- companyId?: string | null
- id?: string
- isMetric?: boolean
- materialFormId: string
- name: string
- }
- Update: {
- companyId?: string | null
- id?: string
- isMetric?: boolean
- materialFormId?: string
- name?: string
- }
- Relationships: [
- {
- foreignKeyName: "materialDimensions_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "companies"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialDimensions_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "company"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialDimensions_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "customFieldTables"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialDimensions_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "integrations"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialDimensions_materialFormId_fkey"
- columns: ["materialFormId"]
- isOneToOne: false
- referencedRelation: "materialForm"
- referencedColumns: ["id"]
- },
- ]
- }
- materialFinish: {
- Row: {
- companyId: string | null
- id: string
- materialSubstanceId: string
- name: string
- }
- Insert: {
- companyId?: string | null
- id?: string
- materialSubstanceId: string
- name: string
- }
- Update: {
- companyId?: string | null
- id?: string
- materialSubstanceId?: string
- name?: string
- }
- Relationships: [
- {
- foreignKeyName: "materialFinish_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "companies"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialFinish_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "company"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialFinish_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "customFieldTables"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialFinish_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "integrations"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialFinish_materialSubstanceId_fkey"
- columns: ["materialSubstanceId"]
- isOneToOne: false
- referencedRelation: "materialSubstance"
- referencedColumns: ["id"]
- },
- ]
- }
materialForm: {
Row: {
companyId: string | null
@@ -12416,63 +12251,6 @@ export type Database = {
},
]
}
- materialGrade: {
- Row: {
- companyId: string | null
- id: string
- materialSubstanceId: string
- name: string
- }
- Insert: {
- companyId?: string | null
- id?: string
- materialSubstanceId: string
- name: string
- }
- Update: {
- companyId?: string | null
- id?: string
- materialSubstanceId?: string
- name?: string
- }
- Relationships: [
- {
- foreignKeyName: "materialGrade_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "companies"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialGrade_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "company"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialGrade_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "customFieldTables"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialGrade_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "integrations"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialGrade_materialSubstanceId_fkey"
- columns: ["materialSubstanceId"]
- isOneToOne: false
- referencedRelation: "materialSubstance"
- referencedColumns: ["id"]
- },
- ]
- }
materialSubstance: {
Row: {
companyId: string | null
@@ -37854,145 +37632,6 @@ export type Database = {
},
]
}
- materialDimensions: {
- Row: {
- companyId: string | null
- formName: string | null
- id: string | null
- isMetric: boolean | null
- materialFormId: string | null
- name: string | null
- }
- Relationships: [
- {
- foreignKeyName: "materialDimensions_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "companies"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialDimensions_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "company"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialDimensions_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "customFieldTables"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialDimensions_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "integrations"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialDimensions_materialFormId_fkey"
- columns: ["materialFormId"]
- isOneToOne: false
- referencedRelation: "materialForm"
- referencedColumns: ["id"]
- },
- ]
- }
- materialFinishes: {
- Row: {
- companyId: string | null
- id: string | null
- materialSubstanceId: string | null
- name: string | null
- substanceName: string | null
- }
- Relationships: [
- {
- foreignKeyName: "materialFinish_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "companies"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialFinish_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "company"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialFinish_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "customFieldTables"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialFinish_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "integrations"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialFinish_materialSubstanceId_fkey"
- columns: ["materialSubstanceId"]
- isOneToOne: false
- referencedRelation: "materialSubstance"
- referencedColumns: ["id"]
- },
- ]
- }
- materialGrades: {
- Row: {
- companyId: string | null
- id: string | null
- materialSubstanceId: string | null
- name: string | null
- substanceName: string | null
- }
- Relationships: [
- {
- foreignKeyName: "materialGrade_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "companies"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialGrade_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "company"
- referencedColumns: ["id"]
- },
- {
- foreignKeyName: "materialGrade_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "customFieldTables"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialGrade_companyId_fkey"
- columns: ["companyId"]
- isOneToOne: false
- referencedRelation: "integrations"
- referencedColumns: ["companyId"]
- },
- {
- foreignKeyName: "materialGrade_materialSubstanceId_fkey"
- columns: ["materialSubstanceId"]
- isOneToOne: false
- referencedRelation: "materialSubstance"
- referencedColumns: ["id"]
- },
- ]
- }
materials: {
Row: {
active: boolean | null
@@ -38775,14 +38414,14 @@ export type Database = {
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["supplierLocationId"]
+ columns: ["id"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["id"]
+ columns: ["supplierLocationId"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
@@ -40120,14 +39759,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["supplierCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["supplierCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -42576,14 +42215,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["invoiceCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["invoiceCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]