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: configurable process parameters
Brad Barbin33621de8705f
diff --git a/apps/erp/app/components/Configurator/ConfigurationEditor/ConfigurationEditor.tsx b/apps/erp/app/components/Configurator/ConfigurationEditor/ConfigurationEditor.tsxindex e0880200fd..0c39cee3e9 100644--- a/apps/erp/app/components/Configurator/ConfigurationEditor/ConfigurationEditor.tsx+++ b/apps/erp/app/components/Configurator/ConfigurationEditor/ConfigurationEditor.tsx@@ -408,7 +408,7 @@ export default function Configurator({Save & Close</Button>- <div className="font-mono mt-4 p-2 bg-accent rounded min-h-[100px] whitespace-pre-wrap">+ <div className="font-mono mt-4 p-2 bg-accent rounded min-h-[100px] max-h-[300px] max-w-[395px] overflow-auto whitespace-pre-wrap">{output}</div></div>diff --git a/apps/erp/app/components/DirectionAwareTabs.tsx b/apps/erp/app/components/DirectionAwareTabs.tsxindex a5cd0b3c2f..f235778504 100644--- a/apps/erp/app/components/DirectionAwareTabs.tsx+++ b/apps/erp/app/components/DirectionAwareTabs.tsx@@ -8,7 +8,7 @@ import useMeasure from "react-use-measure";type Tab = {id: number;- label: string;+ label: string | ReactNode;content: ReactNode;disabled?: boolean;};diff --git a/apps/erp/app/modules/inventory/ui/Shipments/ShipmentLines.tsx b/apps/erp/app/modules/inventory/ui/Shipments/ShipmentLines.tsxindex bda0667d72..66372c3226 100644--- a/apps/erp/app/modules/inventory/ui/Shipments/ShipmentLines.tsx+++ b/apps/erp/app/modules/inventory/ui/Shipments/ShipmentLines.tsx@@ -53,11 +53,11 @@ import { useRouteData } from "~/hooks";import { splitValidator } from "~/modules/inventory";import type {getBatchNumbersForItem,- type BatchProperty,- type getSerialNumbersForItem,- type Shipment,- type ShipmentLine,- type ShipmentLineTracking,+ BatchProperty,+ getSerialNumbersForItem,+ Shipment,+ ShipmentLine,+ ShipmentLineTracking,} from "~/modules/inventory";import type { action as shipmentLinesUpdateAction } from "~/routes/x+/shipment+/lines.update";import { useItems } from "~/stores";diff --git a/apps/erp/app/modules/items/items.service.ts b/apps/erp/app/modules/items/items.service.tsindex 525cfe0b8b..c2f5e29c39 100644--- a/apps/erp/app/modules/items/items.service.ts+++ b/apps/erp/app/modules/items/items.service.ts@@ -6,7 +6,10 @@ import { type z } from "zod";import type { GenericQueryFilters } from "~/utils/query";import { setGenericQueryFilters } from "~/utils/query";import { sanitize } from "~/utils/supabase";-import type { operationToolValidator } from "../shared";+import type {+ operationParameterValidator,+ operationToolValidator,+} from "../shared";import type {configurationParameterGroupOrderValidator,configurationParameterGroupValidator,@@ -155,6 +158,13 @@ export async function deleteMethodMaterial(return client.from("methodMaterial").delete().eq("id", id);}+export async function deleteMethodOperationParameter(+ client: SupabaseClient<Database>,+ id: string+) {+ return client.from("methodOperationParameter").delete().eq("id", id);+}+export async function deleteMethodOperationTool(client: SupabaseClient<Database>,id: string@@ -862,9 +872,7 @@ export async function getMethodOperationsByMakeMethodId() {return client.from("methodOperation")- .select(- "*, methodOperationTool(id, operationId, toolId, quantity, createdBy, createdAt, updatedBy, updatedAt)"- )+ .select("*, methodOperationTool(*), methodOperationParameter(*)").eq("makeMethodId", makeMethodId).order("order", { ascending: true });}@@ -1877,6 +1885,35 @@ export async function upsertMethodOperation(.single();}+export async function upsertMethodOperationParameter(+ client: SupabaseClient<Database>,+ methodOperationParameter:+ | (Omit<z.infer<typeof operationParameterValidator>, "id"> & {+ companyId: string;+ createdBy: string;+ })+ | (Omit<z.infer<typeof operationParameterValidator>, "id"> & {+ id: string;+ updatedBy: string;+ updatedAt: string;+ })+) {+ if ("createdBy" in methodOperationParameter) {+ return client+ .from("methodOperationParameter")+ .insert(methodOperationParameter)+ .select("id")+ .single();+ }++ return client+ .from("methodOperationParameter")+ .update(sanitize(methodOperationParameter))+ .eq("id", methodOperationParameter.id)+ .select("id")+ .single();+}+export async function upsertMethodOperationTool(client: SupabaseClient<Database>,methodOperationTool:diff --git a/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx b/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsxindex e0178fb038..27ed4c1c9a 100644--- a/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx+++ b/apps/erp/app/modules/items/ui/Item/BillOfProcess.tsx@@ -1,6 +1,6 @@"use client";import { useCarbon } from "@carbon/auth";-import { ValidatedForm } from "@carbon/form";+import { Input, ValidatedForm } from "@carbon/form";import type { JSONContent } from "@carbon/react";import {Alert,@@ -13,6 +13,7 @@ import {CardContent,CardHeader,CardTitle,+ Count,DropdownMenu,DropdownMenuContent,DropdownMenuItem,@@ -35,6 +36,7 @@ import { nanoid } from "nanoid";import type { Dispatch, SetStateAction } from "react";import { useEffect, useRef, useState } from "react";import {+ LuActivity,LuChevronDown,LuCirclePlus,LuEllipsisVertical,@@ -74,15 +76,19 @@ import { SortableList, SortableListItem } from "~/components/SortableList";import { usePermissions, useUser } from "~/hooks";import { useTags } from "~/hooks/useTags";-import type { OperationTool } from "~/modules/shared";+import type { OperationParameter, OperationTool } from "~/modules/shared";import {methodOperationOrders,+ operationParameterValidator,operationToolValidator,operationTypes,standardFactorType,} from "~/modules/shared";import type { action as editMethodOperationToolAction } from "~/routes/x+/items+/methods+/operation.tool.$id";+import type { action as editMethodOperationParameterAction } from "~/routes/x+/items+/methods+/operation.parameter.$id";import type { action as newMethodOperationToolAction } from "~/routes/x+/items+/methods+/operation.tool.new";+import type { action as newMethodOperationParameterAction } from "~/routes/x+/items+/methods+/operation.parameter.new";+import { useTools } from "~/stores";import { getPrivateUrl, path } from "~/utils/path";import { methodOperationValidator } from "../../items.models";@@ -93,10 +99,6 @@ type Operation = z.infer<typeof methodOperationValidator> & {tags: string[];};-type OperationWithTools = Operation & {- methodOperationTool: OperationTool[];-};-type ItemWithData = Item & {data: Operation;};@@ -105,7 +107,10 @@ type BillOfProcessProps = {configurable?: boolean;configurationRules?: ConfigurationRule[];makeMethodId: string;- operations: OperationWithTools[];+ operations: (Operation & {+ methodOperationTool: OperationTool[];+ methodOperationParameter: OperationParameter[];+ })[];parameters?: ConfigurationParameter[];tags: { name: string }[];};@@ -379,6 +384,12 @@ const BillOfProcess = ({onRemoveItem,}: SortableItemRenderProps<ItemWithData>) => {const isOpen = item.id === selectedItemId;+ const tools =+ initialOperations.find((o) => o.id === item.id)?.methodOperationTool ??+ [];+ const parameters =+ initialOperations.find((o) => o.id === item.id)+ ?.methodOperationParameter ?? [];const tabs = [{@@ -448,18 +459,43 @@ const BillOfProcess = ({},{id: 2,- label: "Tools",+ label: (+ <span className="flex items-center gap-2">+ <span>Tools</span>+ {tools.length > 0 && <Count count={tools.length} />}+ </span>+ ),content: (<div className="flex w-full flex-col py-4"><ToolsForm- tools={- initialOperations.find((o) => o.id === item.id)- ?.methodOperationTool ?? []+ tools={tools}+ operationId={item.id!}+ isDisabled={+ selectedItemId === null || isTemporaryId(selectedItemId!)}+ />+ </div>+ ),+ },+ {+ id: 3,+ label: (+ <span className="flex items-center gap-2">+ <span>Parameters</span>+ {parameters.length > 0 && <Count count={parameters.length} />}+ </span>+ ),+ content: (+ <div className="flex w-full flex-col py-4">+ <ParametersForm+ parameters={parameters}operationId={item.id!}isDisabled={selectedItemId === null || isTemporaryId(selectedItemId!)}+ configurable={configurable}+ rulesByField={rulesByField}+ onConfigure={onConfigure}/></div>),@@ -578,9 +614,9 @@ const BillOfProcess = ({null);- const onConfigure = (configuration: Configuration) => {+ const onConfigure = (c: Configuration) => {flushSync(() => {- setConfiguration(configuration);+ setConfiguration(c);});configuratorDisclosure.onOpen();};@@ -915,7 +951,6 @@ function OperationForm({onChange={(value) => {setProcessData((d) => ({...d,-setupUnit: "Total Minutes",laborUnit: "Minutes/Piece",machineUnit: "Minutes/Piece",@@ -1349,19 +1384,115 @@ function OperationForm({);}-function ToolsListItem({- tool: { toolId, quantity, id, updatedBy, updatedAt, createdBy, createdAt },+function ParametersForm({+ operationId,+ configurable,+ isDisabled,+ parameters,+ rulesByField,+ onConfigure,+}: {+ operationId: string;+ configurable: boolean;+ isDisabled: boolean;+ parameters: OperationParameter[];+ rulesByField: Map<string, ConfigurationRule>;+ onConfigure?: (c: Configuration) => void;+}) {+ const fetcher = useFetcher<typeof newMethodOperationParameterAction>();++ if (isDisabled && isTemporaryId(operationId)) {+ return (+ <Alert className="max-w-[420px] mx-auto my-8">+ <LuTriangleAlert />+ <AlertTitle>Cannot add parameters to unsaved operation</AlertTitle>+ <AlertDescription>+ Please save the operation before adding parameters.+ </AlertDescription>+ </Alert>+ );+ }++ return (+ <div className="flex flex-col gap-6">+ <div className="p-6 border rounded-lg">+ <ValidatedForm+ action={path.to.newMethodOperationParameter}+ method="post"+ validator={operationParameterValidator}+ fetcher={fetcher}+ resetAfterSubmit+ defaultValues={{+ id: undefined,+ key: "",+ value: "",+ operationId,+ }}+ className="w-full"+ >+ <Hidden name="operationId" />+ <VStack spacing={4}>+ <div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">+ <Input+ name="key"+ label="Key"+ autoFocus={parameters.length === 0}+ />+ <Input name="value" label="Value" />+ </div>+ <Submit+ leftIcon={<LuCirclePlus />}+ isDisabled={isDisabled || fetcher.state !== "idle"}+ isLoading={fetcher.state !== "idle"}+ >+ Add Parameter+ </Submit>+ </VStack>+ </ValidatedForm>+ </div>++ {parameters.length > 0 && (+ <div className="border rounded-lg">+ {[...parameters]+ .sort((a, b) =>+ String(a.id ?? "").localeCompare(String(b.id ?? ""))+ )+ .map((p, index) => (+ <ParametersListItem+ key={p.id}+ parameter={p}+ operationId={operationId}+ className={index === parameters.length - 1 ? "border-none" : ""}+ configurable={configurable}+ rulesByField={rulesByField}+ onConfigure={onConfigure}+ />+ ))}+ </div>+ )}+ </div>+ );+}++function ParametersListItem({+ parameter: { key, value, id, updatedBy, updatedAt, createdBy, createdAt },operationId,className,+ configurable,+ rulesByField,+ onConfigure,}: {- tool: OperationTool;+ parameter: OperationParameter;operationId: string;className?: string;+ configurable: boolean;+ rulesByField: Map<string, ConfigurationRule>;+ onConfigure?: (c: Configuration) => void;}) {const disclosure = useDisclosure();const deleteModalDisclosure = useDisclosure();const submitted = useRef(false);- const fetcher = useFetcher<typeof editMethodOperationToolAction>();+ const fetcher = useFetcher<typeof editMethodOperationParameterAction>();useEffect(() => {if (submitted.current && fetcher.state === "idle") {@@ -1371,21 +1502,19 @@ function ToolsListItem({// eslint-disable-next-line react-hooks/exhaustive-deps}, [fetcher.state]);- const tools = useTools();- const tool = tools.find((t) => t.id === toolId);- if (!tool || !id) return null;-const isUpdated = updatedBy !== null;const person = isUpdated ? updatedBy : createdBy;const date = updatedAt ?? createdAt;+ if (!id) return null;+return (<div className={cn("border-b p-6", className)}>{disclosure.isOpen ? (<ValidatedForm- action={path.to.methodOperationTool(id)}+ action={path.to.methodOperationParameter(id)}method="post"- validator={operationToolValidator}+ validator={operationParameterValidator}fetcher={fetcher}resetAfterSubmitonSubmit={() => {@@ -1393,8 +1522,8 @@ function ToolsListItem({}}defaultValues={{id: id,- toolId: toolId ?? "",- quantity: quantity ?? 1,+ key: key ?? "",+ value: value ?? "",operationId,}}className="w-full"@@ -1402,8 +1531,34 @@ function ToolsListItem({<Hidden name="operationId" /><VStack spacing={4}><div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">- <Tool name="toolId" label="Tool" autoFocus />- <Number name="quantity" label="Quantity" />+ <Input name="key" label="Key" />+ <Input+ name="value"+ label="Value"+ isConfigured={rulesByField.has(+ getFieldKey(`parameter:${id}:value`, operationId)+ )}+ onConfigure={+ configurable && typeof onConfigure === "function"+ ? () => {+ onConfigure({+ label: key,+ field: getFieldKey(+ `parameter:${id}:value`,+ operationId+ ),+ code: rulesByField.get(+ getFieldKey(`parameter:${id}:value`, operationId)+ )?.code,+ defaultValue: value,+ returnType: {+ type: "text",+ },+ });+ }+ : undefined+ }+ /></div><HStack className="w-full justify-end" spacing={2}><Button variant="secondary" onClick={disclosure.onClose}>@@ -1423,16 +1578,20 @@ function ToolsListItem({<HStack spacing={4} className="w-1/2"><HStack spacing={4} className="flex-1"><div className="bg-muted border rounded-full flex items-center justify-center p-2">- <LuHammer className="size-4" />+ <LuActivity+ className={cn(+ "size-4",+ rulesByField.has(+ getFieldKey(`parameter:${id}:value`, operationId)+ ) && "text-emerald-500"+ )}+ /></div><VStack spacing={0}>- <span className="text-sm font-medium">{tool.readableId}</span>- <span className="text-xs text-muted-foreground">- {tool.name}- </span>+ <span className="text-sm font-medium">{key}</span></VStack><span className="text-base text-muted-foreground text-right">- {quantity}+ {value}</span></HStack></HStack>@@ -1468,10 +1627,10 @@ function ToolsListItem({)}{deleteModalDisclosure.isOpen && (<ConfirmDelete- action={path.to.deleteMethodOperationTool(id)}+ action={path.to.deleteMethodOperationParameter(id)}isOpen={deleteModalDisclosure.isOpen}- name={tool.readableId}- text={`Are you sure you want to delete ${tool.readableId} from this operation? This cannot be undone.`}+ name={key}+ text={`Are you sure you want to delete the ${key} parameter from this operation? This cannot be undone.`}onCancel={() => {deleteModalDisclosure.onClose();}}@@ -1527,7 +1686,7 @@ function ToolsForm({<Hidden name="operationId" /><VStack spacing={4}><div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">- <Tool name="toolId" label="Tool" autoFocus />+ <Tool name="toolId" label="Tool" autoFocus={tools.length === 0} /><Number name="quantity" label="Quantity" /></div>@@ -1562,6 +1721,141 @@ function ToolsForm({);}+function ToolsListItem({+ tool: { toolId, quantity, id, updatedBy, updatedAt, createdBy, createdAt },+ operationId,+ className,+}: {+ tool: OperationTool;+ operationId: string;+ className?: string;+}) {+ const disclosure = useDisclosure();+ const deleteModalDisclosure = useDisclosure();+ const submitted = useRef(false);+ const fetcher = useFetcher<typeof editMethodOperationToolAction>();++ useEffect(() => {+ if (submitted.current && fetcher.state === "idle") {+ disclosure.onClose();+ submitted.current = false;+ }+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [fetcher.state]);++ const tools = useTools();+ const tool = tools.find((t) => t.id === toolId);+ if (!tool || !id) return null;++ const isUpdated = updatedBy !== null;+ const person = isUpdated ? updatedBy : createdBy;+ const date = updatedAt ?? createdAt;++ return (+ <div className={cn("border-b p-6", className)}>+ {disclosure.isOpen ? (+ <ValidatedForm+ action={path.to.methodOperationTool(id)}+ method="post"+ validator={operationToolValidator}+ fetcher={fetcher}+ resetAfterSubmit+ onSubmit={() => {+ disclosure.onClose();+ }}+ defaultValues={{+ id: id,+ toolId: toolId ?? "",+ quantity: quantity ?? 1,+ operationId,+ }}+ className="w-full"+ >+ <Hidden name="operationId" />+ <VStack spacing={4}>+ <div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">+ <Tool name="toolId" label="Tool" autoFocus />+ <Number name="quantity" label="Quantity" />+ </div>+ <HStack className="w-full justify-end" spacing={2}>+ <Button variant="secondary" onClick={disclosure.onClose}>+ Cancel+ </Button>+ <Submit+ isDisabled={fetcher.state !== "idle"}+ isLoading={fetcher.state !== "idle"}+ >+ Save+ </Submit>+ </HStack>+ </VStack>+ </ValidatedForm>+ ) : (+ <div className="flex flex-1 justify-between items-center w-full">+ <HStack spacing={4} className="w-1/2">+ <HStack spacing={4} className="flex-1">+ <div className="bg-muted border rounded-full flex items-center justify-center p-2">+ <LuHammer className="size-4" />+ </div>+ <VStack spacing={0}>+ <span className="text-sm font-medium">{tool.readableId}</span>+ <span className="text-xs text-muted-foreground">+ {tool.name}+ </span>+ </VStack>+ <span className="text-base text-muted-foreground text-right">+ {quantity}+ </span>+ </HStack>+ </HStack>+ <div className="flex items-center justify-end gap-2">+ <HStack spacing={2}>+ <span className="text-xs text-muted-foreground">+ {isUpdated ? "Updated" : "Created"} {formatRelativeTime(date)}+ </span>+ <EmployeeAvatar employeeId={person} withName={false} />+ </HStack>+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <IconButton+ aria-label="Open menu"+ icon={<LuEllipsisVertical />}+ variant="ghost"+ />+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ <DropdownMenuItem onClick={disclosure.onOpen}>+ Edit+ </DropdownMenuItem>+ <DropdownMenuItem+ destructive+ onClick={deleteModalDisclosure.onOpen}+ >+ Delete+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ </div>+ </div>+ )}+ {deleteModalDisclosure.isOpen && (+ <ConfirmDelete+ action={path.to.deleteMethodOperationTool(id)}+ isOpen={deleteModalDisclosure.isOpen}+ name={tool.readableId}+ text={`Are you sure you want to delete ${tool.readableId} from this operation? This cannot be undone.`}+ onCancel={() => {+ deleteModalDisclosure.onClose();+ }}+ onSubmit={() => {+ deleteModalDisclosure.onClose();+ }}+ />+ )}+ </div>+ );+}+function makeItems(operations: Operation[],tags: { name: string }[]diff --git a/apps/erp/app/modules/production/production.service.ts b/apps/erp/app/modules/production/production.service.tsindex f8c3efec36..5925472c60 100644--- a/apps/erp/app/modules/production/production.service.ts+++ b/apps/erp/app/modules/production/production.service.ts@@ -5,7 +5,10 @@ import type { StorageItem } from "~/types";import type { GenericQueryFilters } from "~/utils/query";import { setGenericQueryFilters } from "~/utils/query";import { sanitize } from "~/utils/supabase";-import type { operationToolValidator } from "../shared";+import type {+ operationParameterValidator,+ operationToolValidator,+} from "../shared";import type {jobMaterialValidator,jobOperationStatus,@@ -39,6 +42,13 @@ export async function deleteJobOperation(return client.from("jobOperation").delete().eq("id", jobOperationId);}+export async function deleteJobOperationParameter(+ client: SupabaseClient<Database>,+ id: string+) {+ return client.from("jobOperationParameter").delete().eq("id", id);+}+export async function deleteJobOperationTool(client: SupabaseClient<Database>,id: string@@ -387,9 +397,7 @@ export async function getJobOperationsByMethodId() {return client.from("jobOperation")- .select(- "*, jobOperationTool(id, operationId, toolId, quantity, createdBy, createdAt, updatedBy, updatedAt)"- )+ .select("*, jobOperationTool(*), jobOperationParameter(*)").eq("jobMakeMethodId", jobMakeMethodId).order("order", { ascending: true });}@@ -845,6 +853,35 @@ export async function upsertJobOperation(.single();}+export async function upsertJobOperationParameter(+ client: SupabaseClient<Database>,+ jobOperationParameter:+ | (Omit<z.infer<typeof operationParameterValidator>, "id"> & {+ companyId: string;+ createdBy: string;+ })+ | (Omit<z.infer<typeof operationParameterValidator>, "id"> & {+ id: string;+ updatedBy: string;+ updatedAt: string;+ })+) {+ if ("createdBy" in jobOperationParameter) {+ return client+ .from("jobOperationParameter")+ .insert(jobOperationParameter)+ .select("id")+ .single();+ }++ return client+ .from("jobOperationParameter")+ .update(sanitize(jobOperationParameter))+ .eq("id", jobOperationParameter.id)+ .select("id")+ .single();+}+export async function upsertJobOperationTool(client: SupabaseClient<Database>,jobOperationTool:diff --git a/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx b/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsxindex 2c0bf39a4e..e261049044 100644--- a/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx+++ b/apps/erp/app/modules/production/ui/Jobs/JobBillOfProcess.tsx@@ -1,7 +1,7 @@"use client";import { useCarbon } from "@carbon/auth";import type { Database } from "@carbon/database";-import { ValidatedForm } from "@carbon/form";+import { Input, ValidatedForm } from "@carbon/form";import type { JSONContent } from "@carbon/react";import {Alert,@@ -15,13 +15,14 @@ import {CardContent,CardHeader,CardTitle,+ Count,DropdownMenu,DropdownMenuContent,DropdownMenuItem,DropdownMenuTrigger,HStack,IconButton,- Input,+ Input as InputField,Label,Loading,ScrollArea,@@ -46,6 +47,7 @@ import type { Dispatch, SetStateAction } from "react";import { useCallback, useEffect, useRef, useState } from "react";import { flushSync } from "react-dom";import {+ LuActivity,LuChevronDown,LuCirclePlus,LuDollarSign,@@ -88,13 +90,16 @@ import type { Item, SortableItemRenderProps } from "~/components/SortableList";import { SortableList, SortableListItem } from "~/components/SortableList";import { usePermissions, useRouteData, useUrlParams, useUser } from "~/hooks";import { useTags } from "~/hooks/useTags";-import type { OperationTool } from "~/modules/shared";+import type { OperationParameter, OperationTool } from "~/modules/shared";import {methodOperationOrders,+ operationParameterValidator,operationToolValidator,operationTypes,} from "~/modules/shared";+import type { action as editJobOperationParameterAction } from "~/routes/x+/job+/methods+/operation.parameter.$id";import type { action as editJobOperationToolAction } from "~/routes/x+/job+/methods+/operation.tool.$id";+import type { action as newJobOperationParameterAction } from "~/routes/x+/job+/methods+/operation.parameter.new";import type { action as newJobOperationToolAction } from "~/routes/x+/job+/methods+/operation.tool.new";import { usePeople, useTools } from "~/stores";import { getPrivateUrl, path } from "~/utils/path";@@ -119,6 +124,7 @@ type JobBillOfProcessProps = {locationId: string;operations: (Operation & {jobOperationTool: OperationTool[];+ jobOperationParameter: OperationParameter[];})[];tags: { name: string }[];};@@ -599,6 +605,13 @@ const JobBillOfProcess = ({onRemoveItem,}: SortableItemRenderProps<ItemWithData>) => {const isOpen = item.id === selectedItemId;++ const tools =+ initialOperations.find((o) => o.id === item.id)?.jobOperationTool ?? [];+ const parameters =+ initialOperations.find((o) => o.id === item.id)?.jobOperationParameter ??+ [];+const tabs = [{id: 0,@@ -666,13 +679,16 @@ const JobBillOfProcess = ({},{id: 2,- label: "Tools",+ label: (+ <span className="flex items-center gap-2">+ <span>Tools</span>+ {tools.length > 0 && <Count count={tools.length} />}+ </span>+ ),content: (<div className="flex w-full flex-col py-4"><ToolsForm- tools={- operations.find((o) => o.id === item.id)?.jobOperationTool ?? []- }+ tools={tools}operationId={item.id!}isDisabled={selectedItemId === null || isTemporaryId(selectedItemId!)@@ -683,6 +699,26 @@ const JobBillOfProcess = ({},{id: 3,+ label: (+ <span className="flex items-center gap-2">+ <span>Parameters</span>+ {parameters.length > 0 && <Count count={parameters.length} />}+ </span>+ ),+ content: (+ <div className="flex w-full flex-col py-4">+ <ParametersForm+ parameters={parameters}+ operationId={item.id!}+ isDisabled={+ selectedItemId === null || isTemporaryId(selectedItemId!)+ }+ />+ </div>+ ),+ },+ {+ id: 4,label: "Events",content: (<div className="flex w-full flex-col pr-2 py-6 min-h-[300px]">@@ -707,7 +743,7 @@ const JobBillOfProcess = ({),},{- id: 4,+ id: 5,label: "Chat",content: <OperationChat jobOperationId={item.id} />,},@@ -860,6 +896,217 @@ function isTemporaryId(id: string) {return id.length < 20;}+function ParametersForm({+ operationId,+ isDisabled,+ parameters,+}: {+ operationId: string;+ isDisabled: boolean;+ parameters: OperationParameter[];+}) {+ const fetcher = useFetcher<typeof newJobOperationParameterAction>();++ if (isDisabled && isTemporaryId(operationId)) {+ return (+ <Alert className="max-w-[420px] mx-auto my-8">+ <LuTriangleAlert />+ <AlertTitle>Cannot add parameters to unsaved operation</AlertTitle>+ <AlertDescription>+ Please save the operation before adding parameters.+ </AlertDescription>+ </Alert>+ );+ }++ return (+ <div className="flex flex-col gap-6">+ <div className="p-6 border rounded-lg">+ <ValidatedForm+ action={path.to.newJobOperationParameter}+ method="post"+ validator={operationParameterValidator}+ fetcher={fetcher}+ resetAfterSubmit+ defaultValues={{+ id: undefined,+ key: "",+ value: "",+ operationId,+ }}+ className="w-full"+ >+ <Hidden name="operationId" />+ <VStack spacing={4}>+ <div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">+ <Input+ name="key"+ label="Key"+ autoFocus={parameters.length === 0}+ />+ <Input name="value" label="Value" />+ </div>+ <Submit+ leftIcon={<LuCirclePlus />}+ isDisabled={isDisabled || fetcher.state !== "idle"}+ isLoading={fetcher.state !== "idle"}+ >+ Add Parameter+ </Submit>+ </VStack>+ </ValidatedForm>+ </div>++ {parameters.length > 0 && (+ <div className="border rounded-lg">+ {[...parameters]+ .sort((a, b) =>+ String(a.id ?? "").localeCompare(String(b.id ?? ""))+ )+ .map((p, index) => (+ <ParametersListItem+ key={p.id}+ parameter={p}+ operationId={operationId}+ className={index === parameters.length - 1 ? "border-none" : ""}+ />+ ))}+ </div>+ )}+ </div>+ );+}++function ParametersListItem({+ parameter: { key, value, id, updatedBy, updatedAt, createdBy, createdAt },+ operationId,+ className,+}: {+ parameter: OperationParameter;+ operationId: string;+ className?: string;+}) {+ const disclosure = useDisclosure();+ const deleteModalDisclosure = useDisclosure();+ const submitted = useRef(false);+ const fetcher = useFetcher<typeof editJobOperationParameterAction>();++ useEffect(() => {+ if (submitted.current && fetcher.state === "idle") {+ disclosure.onClose();+ submitted.current = false;+ }+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [fetcher.state]);++ const isUpdated = updatedBy !== null;+ const person = isUpdated ? updatedBy : createdBy;+ const date = updatedAt ?? createdAt;++ if (!id) return null;++ return (+ <div className={cn("border-b p-6", className)}>+ {disclosure.isOpen ? (+ <ValidatedForm+ action={path.to.jobOperationParameter(id)}+ method="post"+ validator={operationParameterValidator}+ fetcher={fetcher}+ resetAfterSubmit+ onSubmit={() => {+ disclosure.onClose();+ }}+ defaultValues={{+ id: id,+ key: key ?? "",+ value: value ?? "",+ operationId,+ }}+ className="w-full"+ >+ <Hidden name="operationId" />+ <VStack spacing={4}>+ <div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">+ <Input name="key" label="Key" />+ <Input name="value" label="Value" />+ </div>+ <HStack className="w-full justify-end" spacing={2}>+ <Button variant="secondary" onClick={disclosure.onClose}>+ Cancel+ </Button>+ <Submit+ isDisabled={fetcher.state !== "idle"}+ isLoading={fetcher.state !== "idle"}+ >+ Save+ </Submit>+ </HStack>+ </VStack>+ </ValidatedForm>+ ) : (+ <div className="flex flex-1 justify-between items-center w-full">+ <HStack spacing={4} className="w-1/2">+ <HStack spacing={4} className="flex-1">+ <div className="bg-muted border rounded-full flex items-center justify-center p-2">+ <LuActivity className="size-4" />+ </div>+ <VStack spacing={0}>+ <span className="text-sm font-medium">{key}</span>+ </VStack>+ <span className="text-base text-muted-foreground text-right">+ {value}+ </span>+ </HStack>+ </HStack>+ <div className="flex items-center justify-end gap-2">+ <HStack spacing={2}>+ <span className="text-xs text-muted-foreground">+ {isUpdated ? "Updated" : "Created"} {formatRelativeTime(date)}+ </span>+ <EmployeeAvatar employeeId={person} withName={false} />+ </HStack>+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <IconButton+ aria-label="Open menu"+ icon={<LuEllipsisVertical />}+ variant="ghost"+ />+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ <DropdownMenuItem onClick={disclosure.onOpen}>+ Edit+ </DropdownMenuItem>+ <DropdownMenuItem+ destructive+ onClick={deleteModalDisclosure.onOpen}+ >+ Delete+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ </div>+ </div>+ )}+ {deleteModalDisclosure.isOpen && (+ <ConfirmDelete+ action={path.to.deleteJobOperationParameter(id)}+ isOpen={deleteModalDisclosure.isOpen}+ name={key}+ text={`Are you sure you want to delete the ${key} parameter from this operation? This cannot be undone.`}+ onCancel={() => {+ deleteModalDisclosure.onClose();+ }}+ onSubmit={() => {+ deleteModalDisclosure.onClose();+ }}+ />+ )}+ </div>+ );+}+function OperationForm({item,isDisabled,@@ -2027,7 +2274,7 @@ function OperationChat({ jobOperationId }: { jobOperationId: string }) {<div><form className="flex gap-2" onSubmit={handleSubmit}>- <Input+ <InputFieldclassName="flex-1"placeholder="Type a message..."name="message"diff --git a/apps/erp/app/modules/sales/sales.service.ts b/apps/erp/app/modules/sales/sales.service.tsindex e434b78dfc..f7015175c3 100644--- a/apps/erp/app/modules/sales/sales.service.ts+++ b/apps/erp/app/modules/sales/sales.service.ts@@ -7,7 +7,10 @@ import type { GenericQueryFilters } from "~/utils/query";import { setGenericQueryFilters } from "~/utils/query";import { sanitize } from "~/utils/supabase";import { getCurrencyByCode } from "../accounting";-import type { operationToolValidator } from "../shared";+import type {+ operationParameterValidator,+ operationToolValidator,+} from "../shared";import { upsertExternalLink } from "../shared/shared.service";import type {customerAccountingValidator,@@ -216,6 +219,13 @@ export async function deleteQuoteOperation(return client.from("quoteOperation").delete().eq("id", quoteOperationId);}+export async function deleteQuoteOperationParameter(+ client: SupabaseClient<Database>,+ id: string+) {+ return client.from("quoteOperationParameter").delete().eq("id", id);+}+export async function deleteQuoteOperationTool(client: SupabaseClient<Database>,id: string@@ -969,9 +979,7 @@ export async function getQuoteOperationsByMethodId() {return client.from("quoteOperation")- .select(- "*, quoteOperationTool(id, operationId, toolId, quantity, createdBy, createdAt, updatedBy, updatedAt)"- )+ .select("*, quoteOperationTool(*), quoteOperationParameter(*)").eq("quoteMakeMethodId", quoteMakeMethodId).order("order", { ascending: true });}@@ -2168,6 +2176,35 @@ export async function upsertQuoteOperation(.single();}+export async function upsertQuoteOperationParameter(+ client: SupabaseClient<Database>,+ quoteOperationParameter:+ | (Omit<z.infer<typeof operationParameterValidator>, "id"> & {+ companyId: string;+ createdBy: string;+ })+ | (Omit<z.infer<typeof operationParameterValidator>, "id"> & {+ id: string;+ updatedBy: string;+ updatedAt: string;+ })+) {+ if ("createdBy" in quoteOperationParameter) {+ return client+ .from("quoteOperationParameter")+ .insert(quoteOperationParameter)+ .select("id")+ .single();+ }++ return client+ .from("quoteOperationParameter")+ .update(sanitize(quoteOperationParameter))+ .eq("id", quoteOperationParameter.id)+ .select("id")+ .single();+}+export async function upsertQuoteOperationTool(client: SupabaseClient<Database>,quoteOperationTool:diff --git a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsxindex 24c2198333..808a697bea 100644--- a/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx+++ b/apps/erp/app/modules/sales/ui/Quotes/QuoteBillOfProcess.tsx@@ -1,6 +1,6 @@"use client";import { useCarbon } from "@carbon/auth";-import { ValidatedForm } from "@carbon/form";+import { Input, ValidatedForm } from "@carbon/form";import type { JSONContent } from "@carbon/react";import {Alert,@@ -13,6 +13,7 @@ import {CardContent,CardHeader,CardTitle,+ Count,DropdownMenu,DropdownMenuContent,DropdownMenuItem,@@ -34,6 +35,7 @@ import { nanoid } from "nanoid";import type { Dispatch, SetStateAction } from "react";import { useEffect, useRef, useState } from "react";import {+ LuActivity,LuChevronDown,LuCirclePlus,LuDollarSign,@@ -56,7 +58,6 @@ import {StandardFactor,Submit,SupplierProcess,- Tags,Tool,UnitHint,WorkCenter,@@ -67,15 +68,17 @@ import { ConfirmDelete } from "~/components/Modals";import type { Item, SortableItemRenderProps } from "~/components/SortableList";import { SortableList, SortableListItem } from "~/components/SortableList";import { usePermissions, useRouteData, useUser } from "~/hooks";-import { useTags } from "~/hooks/useTags";-import type { OperationTool } from "~/modules/shared";+import type { OperationParameter, OperationTool } from "~/modules/shared";import {methodOperationOrders,+ operationParameterValidator,operationToolValidator,operationTypes,} from "~/modules/shared";import type { action as editQuoteOperationToolAction } from "~/routes/x+/quote+/methods+/operation.tool.$id";+import type { action as editQuoteOperationParameterAction } from "~/routes/x+/quote+/methods+/operation.parameter.$id";import type { action as newQuoteOperationToolAction } from "~/routes/x+/quote+/methods+/operation.tool.new";+import type { action as newQuoteOperationParameterAction } from "~/routes/x+/quote+/methods+/operation.parameter.new";import { useTools } from "~/stores";import { getPrivateUrl, path } from "~/utils/path";import { quoteOperationValidator } from "../../sales.models";@@ -86,17 +89,16 @@ export type Operation = z.infer<typeof quoteOperationValidator> & {tags: string[];};-type OperationWithTools = Operation & {- quoteOperationTool: OperationTool[];-};-type ItemWithData = Item & {data: Operation;};type QuoteBillOfProcessProps = {quoteMakeMethodId: string;- operations: OperationWithTools[];+ operations: (Operation & {+ quoteOperationTool: OperationTool[];+ quoteOperationParameter: OperationParameter[];+ })[];tags: { name: string }[];};@@ -451,6 +453,12 @@ const QuoteBillOfProcess = ({onRemoveItem,}: SortableItemRenderProps<ItemWithData>) => {const isOpen = item.id === selectedItemId;+ const tools =+ initialOperations.find((o) => o.id === item.id)?.quoteOperationTool ?? [];+ const parameters =+ initialOperations.find((o) => o.id === item.id)+ ?.quoteOperationParameter ?? [];+const tabs = [{id: 0,@@ -517,14 +525,36 @@ const QuoteBillOfProcess = ({},{id: 2,- label: "Tools",+ label: (+ <span className="flex items-center gap-2">+ <span>Tools</span>+ {tools.length > 0 && <Count count={tools.length} />}+ </span>+ ),content: (<div className="flex w-full flex-col py-4"><ToolsForm- tools={- operations.find((o) => o.id === item.id)?.quoteOperationTool ??- []+ tools={tools}+ operationId={item.id!}+ isDisabled={+ selectedItemId === null || isTemporaryId(selectedItemId!)}+ />+ </div>+ ),+ },+ {+ id: 3,+ label: (+ <span className="flex items-center gap-2">+ <span>Parameters</span>+ {parameters.length > 0 && <Count count={parameters.length} />}+ </span>+ ),+ content: (+ <div className="flex w-full flex-col py-4">+ <ParametersForm+ parameters={parameters}operationId={item.id!}isDisabled={selectedItemId === null || isTemporaryId(selectedItemId!)@@ -682,6 +712,217 @@ export function isTemporaryId(id: string) {return id.length < 20;}+function ParametersForm({+ operationId,+ isDisabled,+ parameters,+}: {+ operationId: string;+ isDisabled: boolean;+ parameters: OperationParameter[];+}) {+ const fetcher = useFetcher<typeof newQuoteOperationParameterAction>();++ if (isDisabled && isTemporaryId(operationId)) {+ return (+ <Alert className="max-w-[420px] mx-auto my-8">+ <LuTriangleAlert />+ <AlertTitle>Cannot add parameters to unsaved operation</AlertTitle>+ <AlertDescription>+ Please save the operation before adding parameters.+ </AlertDescription>+ </Alert>+ );+ }++ return (+ <div className="flex flex-col gap-6">+ <div className="p-6 border rounded-lg">+ <ValidatedForm+ action={path.to.newQuoteOperationParameter}+ method="post"+ validator={operationParameterValidator}+ fetcher={fetcher}+ resetAfterSubmit+ defaultValues={{+ id: undefined,+ key: "",+ value: "",+ operationId,+ }}+ className="w-full"+ >+ <Hidden name="operationId" />+ <VStack spacing={4}>+ <div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">+ <Input+ name="key"+ label="Key"+ autoFocus={parameters.length === 0}+ />+ <Input name="value" label="Value" />+ </div>+ <Submit+ leftIcon={<LuCirclePlus />}+ isDisabled={isDisabled || fetcher.state !== "idle"}+ isLoading={fetcher.state !== "idle"}+ >+ Add Parameter+ </Submit>+ </VStack>+ </ValidatedForm>+ </div>++ {parameters.length > 0 && (+ <div className="border rounded-lg">+ {[...parameters]+ .sort((a, b) =>+ String(a.id ?? "").localeCompare(String(b.id ?? ""))+ )+ .map((p, index) => (+ <ParametersListItem+ key={p.id}+ parameter={p}+ operationId={operationId}+ className={index === parameters.length - 1 ? "border-none" : ""}+ />+ ))}+ </div>+ )}+ </div>+ );+}++function ParametersListItem({+ parameter: { key, value, id, updatedBy, updatedAt, createdBy, createdAt },+ operationId,+ className,+}: {+ parameter: OperationParameter;+ operationId: string;+ className?: string;+}) {+ const disclosure = useDisclosure();+ const deleteModalDisclosure = useDisclosure();+ const submitted = useRef(false);+ const fetcher = useFetcher<typeof editQuoteOperationParameterAction>();++ useEffect(() => {+ if (submitted.current && fetcher.state === "idle") {+ disclosure.onClose();+ submitted.current = false;+ }+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, [fetcher.state]);++ const isUpdated = updatedBy !== null;+ const person = isUpdated ? updatedBy : createdBy;+ const date = updatedAt ?? createdAt;++ if (!id) return null;++ return (+ <div className={cn("border-b p-6", className)}>+ {disclosure.isOpen ? (+ <ValidatedForm+ action={path.to.quoteOperationParameter(id)}+ method="post"+ validator={operationParameterValidator}+ fetcher={fetcher}+ resetAfterSubmit+ onSubmit={() => {+ disclosure.onClose();+ }}+ defaultValues={{+ id: id,+ key: key ?? "",+ value: value ?? "",+ operationId,+ }}+ className="w-full"+ >+ <Hidden name="operationId" />+ <VStack spacing={4}>+ <div className="w-full grid grid-cols-1 lg:grid-cols-2 gap-4 items-start">+ <Input name="key" label="Key" />+ <Input name="value" label="Value" />+ </div>+ <HStack className="w-full justify-end" spacing={2}>+ <Button variant="secondary" onClick={disclosure.onClose}>+ Cancel+ </Button>+ <Submit+ isDisabled={fetcher.state !== "idle"}+ isLoading={fetcher.state !== "idle"}+ >+ Save+ </Submit>+ </HStack>+ </VStack>+ </ValidatedForm>+ ) : (+ <div className="flex flex-1 justify-between items-center w-full">+ <HStack spacing={4} className="w-1/2">+ <HStack spacing={4} className="flex-1">+ <div className="bg-muted border rounded-full flex items-center justify-center p-2">+ <LuActivity className="size-4" />+ </div>+ <VStack spacing={0}>+ <span className="text-sm font-medium">{key}</span>+ </VStack>+ <span className="text-base text-muted-foreground text-right">+ {value}+ </span>+ </HStack>+ </HStack>+ <div className="flex items-center justify-end gap-2">+ <HStack spacing={2}>+ <span className="text-xs text-muted-foreground">+ {isUpdated ? "Updated" : "Created"} {formatRelativeTime(date)}+ </span>+ <EmployeeAvatar employeeId={person} withName={false} />+ </HStack>+ <DropdownMenu>+ <DropdownMenuTrigger asChild>+ <IconButton+ aria-label="Open menu"+ icon={<LuEllipsisVertical />}+ variant="ghost"+ />+ </DropdownMenuTrigger>+ <DropdownMenuContent align="end">+ <DropdownMenuItem onClick={disclosure.onOpen}>+ Edit+ </DropdownMenuItem>+ <DropdownMenuItem+ destructive+ onClick={deleteModalDisclosure.onOpen}+ >+ Delete+ </DropdownMenuItem>+ </DropdownMenuContent>+ </DropdownMenu>+ </div>+ </div>+ )}+ {deleteModalDisclosure.isOpen && (+ <ConfirmDelete+ action={path.to.deleteQuoteOperationParameter(id)}+ isOpen={deleteModalDisclosure.isOpen}+ name={key}+ text={`Are you sure you want to delete the ${key} parameter from this operation? This cannot be undone.`}+ onCancel={() => {+ deleteModalDisclosure.onClose();+ }}+ onSubmit={() => {+ deleteModalDisclosure.onClose();+ }}+ />+ )}+ </div>+ );+}+function OperationForm({item,isDisabled,@@ -1588,37 +1829,3 @@ function ToolsForm({</div>);}--export function QuoteOperationTags({- operation,- availableTags,-}: {- operation: Operation;- availableTags: { name: string }[];-}) {- const { onUpdateTags } = useTags({- id: operation.id,- table: "quoteOperation",- });-- return (- <ValidatedForm- defaultValues={{- tags: operation.tags ?? [],- }}- validator={z.object({- tags: z.array(z.string()).optional(),- })}- >- <Tags- availableTags={availableTags}- label=""- name="tags"- table="operation"- inline- maxPreview={3}- onChange={onUpdateTags}- />- </ValidatedForm>- );-}diff --git a/apps/erp/app/modules/shared/shared.models.ts b/apps/erp/app/modules/shared/shared.models.tsindex fb4a8a709c..312a8c37af 100644--- a/apps/erp/app/modules/shared/shared.models.ts+++ b/apps/erp/app/modules/shared/shared.models.ts@@ -91,6 +91,13 @@ export const operationToolValidator = z.object({),});+export const operationParameterValidator = z.object({+ id: zfd.text(z.string().optional()),+ operationId: z.string().min(1, { message: "Operation is required" }),+ key: z.string().min(1, { message: "Key is required" }),+ value: z.string().min(1, { message: "Value is required" }),+});+export const savedViewValidator = z.object({id: zfd.text(z.string().optional()),table: z.string(),diff --git a/apps/erp/app/modules/shared/types.ts b/apps/erp/app/modules/shared/types.tsindex 130f83c280..4f92842f5d 100644--- a/apps/erp/app/modules/shared/types.ts+++ b/apps/erp/app/modules/shared/types.ts@@ -4,6 +4,7 @@ import type { StorageItem } from "~/types";import type {methodItemType,methodType,+ operationParameterValidator,operationToolValidator,standardFactorType,} from "./shared.models";@@ -53,6 +54,12 @@ export type OperationTool = z.infer<typeof operationToolValidator> & {updatedAt: string | null;};+export type OperationParameter = z.infer<typeof operationParameterValidator> & {+ createdBy: string;+ createdAt: string;+ updatedBy: string | null;+ updatedAt: string | null;+};export type OptimisticFileObject = Omit<StorageItem,"owner" | "updated_at" | "created_at" | "last_accessed_at" | "buckets"diff --git a/apps/erp/app/routes/x+/items+/methods+/operation.parameter.$id.tsx b/apps/erp/app/routes/x+/items+/methods+/operation.parameter.$id.tsxnew file mode 100644index 0000000000..d22e4d82a3--- /dev/null+++ b/apps/erp/app/routes/x+/items+/methods+/operation.parameter.$id.tsx@@ -0,0 +1,67 @@+import { assertIsPost, error, success } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { flash } from "@carbon/auth/session.server";+import { validator } from "@carbon/form";+import { json, type ActionFunctionArgs } from "@vercel/remix";+import { upsertMethodOperationParameter } from "~/modules/items";+import { operationParameterValidator } from "~/modules/shared";++export async function action({ request, params }: ActionFunctionArgs) {+ assertIsPost(request);+ const { client, companyId, userId } = await requirePermissions(request, {+ update: "parts",+ });++ const { id } = params;+ if (!id) {+ return json({ success: false, message: "Invalid operation parameter id" });+ }++ const formData = await request.formData();+ const validation = await validator(operationParameterValidator).validate(+ formData+ );++ if (validation.error) {+ return json({ success: false, message: "Invalid form data" });+ }++ const { id: _id, ...data } = validation.data;++ const update = await upsertMethodOperationParameter(client, {+ id,+ ...data,+ companyId,+ updatedBy: userId,+ updatedAt: new Date().toISOString(),+ });+ if (update.error) {+ return json(+ {+ id: null,+ },+ await flash(+ request,+ error(update.error, "Failed to update method operation parameter")+ )+ );+ }++ const methodOperationParameterId = update.data?.id;+ if (!methodOperationParameterId) {+ return json(+ {+ id: null,+ },+ await flash(+ request,+ error(update.error, "Failed to update method operation parameter")+ )+ );+ }++ return json(+ { id: methodOperationParameterId },+ await flash(request, success("Method operation parameter updated"))+ );+}diff --git a/apps/erp/app/routes/x+/items+/methods+/operation.parameter.delete.$id.tsx b/apps/erp/app/routes/x+/items+/methods+/operation.parameter.delete.$id.tsxnew file mode 100644index 0000000000..0259f0407a--- /dev/null+++ b/apps/erp/app/routes/x+/items+/methods+/operation.parameter.delete.$id.tsx@@ -0,0 +1,38 @@+import { assertIsPost, error } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { flash } from "@carbon/auth/session.server";+import { json, type ActionFunctionArgs } from "@vercel/remix";+import { deleteMethodOperationParameter } from "~/modules/items";++export async function action({ request, params }: ActionFunctionArgs) {+ assertIsPost(request);+ const { client } = await requirePermissions(request, {+ delete: "parts",+ });++ const { id } = params;+ if (!id) {+ throw new Error("id not found");+ }++ const deleteOperationParameter = await deleteMethodOperationParameter(+ client,+ id+ );+ if (deleteOperationParameter.error) {+ return json(+ {+ id: null,+ },+ await flash(+ request,+ error(+ deleteOperationParameter.error,+ "Failed to delete method operation parameter"+ )+ )+ );+ }++ return json({});+}diff --git a/apps/erp/app/routes/x+/items+/methods+/operation.parameter.new.tsx b/apps/erp/app/routes/x+/items+/methods+/operation.parameter.new.tsxnew file mode 100644index 0000000000..7eeaf4a7e5--- /dev/null+++ b/apps/erp/app/routes/x+/items+/methods+/operation.parameter.new.tsx@@ -0,0 +1,55 @@+import { assertIsPost, error } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { flash } from "@carbon/auth/session.server";+import { validationError, validator } from "@carbon/form";+import { json, type ActionFunctionArgs } from "@vercel/remix";+import { upsertMethodOperationParameter } from "~/modules/items";+import { operationParameterValidator } from "~/modules/shared";++export async function action({ request }: ActionFunctionArgs) {+ assertIsPost(request);+ const { client, companyId, userId } = await requirePermissions(request, {+ create: "parts",+ });++ const formData = await request.formData();+ const validation = await validator(operationParameterValidator).validate(+ formData+ );++ if (validation.error) {+ return validationError(validation.error);+ }++ const insert = await upsertMethodOperationParameter(client, {+ ...validation.data,+ companyId,+ createdBy: userId,+ });+ if (insert.error) {+ return json(+ {+ id: null,+ },+ await flash(+ request,+ error(insert.error, "Failed to insert method operation parameter")+ )+ );+ }++ const methodOperationParameterId = insert.data?.id;+ if (!methodOperationParameterId) {+ return json(+ {+ id: null,+ },+ await flash(+ request,+ error(insert.error, "Failed to insert method operation tool")+ )+ );+ }++ return json({ id: methodOperationParameterId });+}diff --git a/apps/erp/app/routes/x+/job+/methods+/operation.parameter.$id.tsx b/apps/erp/app/routes/x+/job+/methods+/operation.parameter.$id.tsxnew file mode 100644index 0000000000..a19f75ad4c--- /dev/null+++ b/apps/erp/app/routes/x+/job+/methods+/operation.parameter.$id.tsx@@ -0,0 +1,67 @@+import { assertIsPost, error, success } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { flash } from "@carbon/auth/session.server";+import { validator } from "@carbon/form";+import { json, type ActionFunctionArgs } from "@vercel/remix";+import { upsertJobOperationParameter } from "~/modules/production";+import { operationParameterValidator } from "~/modules/shared";++export async function action({ request, params }: ActionFunctionArgs) {+ assertIsPost(request);+ const { client, companyId, userId } = await requirePermissions(request, {+ update: "production",+ });++ const { id } = params;+ if (!id) {+ return json({ success: false, message: "Invalid operation parameter id" });+ }++ const formData = await request.formData();+ const validation = await validator(operationParameterValidator).validate(+ formData+ );++ if (validation.error) {+ return json({ success: false, message: "Invalid form data" });+ }++ const { id: _id, ...data } = validation.data;++ const update = await upsertJobOperationParameter(client, {+ id,+ ...data,+ companyId,+ updatedBy: userId,+ updatedAt: new Date().toISOString(),+ });+ if (update.error) {+ return json(+ {+ id: null,+ },+ await flash(+ request,+ error(update.error, "Failed to update job operation parameter")+ )+ );+ }++ const operationParameterId = update.data?.id;+ if (!operationParameterId) {+ return json(+ {+ id: null,+ },+ await flash(+ request,+ error(update.error, "Failed to update job operation parameter")+ )+ );+ }++ return json(+ { id: operationParameterId },+ await flash(request, success("Job operation parameter updated"))+ );+}diff --git a/apps/erp/app/routes/x+/job+/methods+/operation.parameter.delete.$id.tsx b/apps/erp/app/routes/x+/job+/methods+/operation.parameter.delete.$id.tsxnew file mode 100644index 0000000000..11dde2bb18--- /dev/null+++ b/apps/erp/app/routes/x+/job+/methods+/operation.parameter.delete.$id.tsx@@ -0,0 +1,38 @@+import { assertIsPost, error } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { flash } from "@carbon/auth/session.server";+import { json, type ActionFunctionArgs } from "@vercel/remix";+import { deleteJobOperationParameter } from "~/modules/production";++export async function action({ request, params }: ActionFunctionArgs) {+ assertIsPost(request);+ const { client } = await requirePermissions(request, {+ delete: "production",+ });++ const { id } = params;+ if (!id) {+ throw new Error("id not found");+ }++ const deleteOperationParameter = await deleteJobOperationParameter(+ client,+ id+ );+ if (deleteOperationParameter.error) {+ return json(+ {+ id: null,+ },+ await flash(+ request,+ error(+ deleteOperationParameter.error,+ "Failed to delete job operation parameter"+ )+ )+ );+ }++ return json({});+}diff --git a/apps/erp/app/routes/x+/job+/methods+/operation.parameter.new.tsx b/apps/erp/app/routes/x+/job+/methods+/operation.parameter.new.tsxnew file mode 100644index 0000000000..b730399664--- /dev/null+++ b/apps/erp/app/routes/x+/job+/methods+/operation.parameter.new.tsx@@ -0,0 +1,55 @@+import { assertIsPost, error } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { flash } from "@carbon/auth/session.server";+import { validationError, validator } from "@carbon/form";+import { json, type ActionFunctionArgs } from "@vercel/remix";+import { upsertJobOperationParameter } from "~/modules/production";+import { operationParameterValidator } from "~/modules/shared";++export async function action({ request }: ActionFunctionArgs) {+ assertIsPost(request);+ const { client, companyId, userId } = await requirePermissions(request, {+ create: "production",+ });++ const formData = await request.formData();+ const validation = await validator(operationParameterValidator).validate(+ formData+ );++ if (validation.error) {+ return validationError(validation.error);+ }++ const insert = await upsertJobOperationParameter(client, {+ ...validation.data,+ companyId,+ createdBy: userId,+ });+ if (insert.error) {+ return json(+ {+ id: null,+ },+ await flash(+ request,+ error(insert.error, "Failed to insert job operation parameter")+ )+ );+ }++ const jobOperationParameterId = insert.data?.id;+ if (!jobOperationParameterId) {+ return json(+ {+ id: null,+ },+ await flash(+ request,+ error(insert.error, "Failed to insert job operation parameter")+ )+ );+ }++ return json({ id: jobOperationParameterId });+}diff --git a/apps/erp/app/routes/x+/quote+/methods+/operation.parameter.$id.tsx b/apps/erp/app/routes/x+/quote+/methods+/operation.parameter.$id.tsxnew file mode 100644index 0000000000..dcf13e9163--- /dev/null+++ b/apps/erp/app/routes/x+/quote+/methods+/operation.parameter.$id.tsx@@ -0,0 +1,67 @@+import { assertIsPost, error, success } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { flash } from "@carbon/auth/session.server";+import { validator } from "@carbon/form";+import { json, type ActionFunctionArgs } from "@vercel/remix";+import { upsertQuoteOperationParameter } from "~/modules/sales";+import { operationParameterValidator } from "~/modules/shared";++export async function action({ request, params }: ActionFunctionArgs) {+ assertIsPost(request);+ const { client, companyId, userId } = await requirePermissions(request, {+ update: "parts",+ });++ const { id } = params;+ if (!id) {+ return json({ success: false, message: "Invalid operation parameter id" });+ }++ const formData = await request.formData();+ const validation = await validator(operationParameterValidator).validate(+ formData+ );++ if (validation.error) {+ return json({ success: false, message: "Invalid form data" });+ }++ const { id: _id, ...data } = validation.data;++ const update = await upsertQuoteOperationParameter(client, {+ id,+ ...data,+ companyId,+ updatedBy: userId,+ updatedAt: new Date().toISOString(),+ });+ if (update.error) {+ return json(+ {+ id: null,+ },+ await flash(+ request,+ error(update.error, "Failed to update operation parameter")+ )+ );+ }++ const operationParameterId = update.data?.id;+ if (!operationParameterId) {+ return json(+ {+ id: null,+ },+ await flash(+ request,+ error(update.error, "Failed to update operation parameter")+ )+ );+ }++ return json(+ { id: operationParameterId },+ await flash(request, success("Quote operation parameter updated"))+ );+}diff --git a/apps/erp/app/routes/x+/quote+/methods+/operation.parameter.delete.$id.tsx b/apps/erp/app/routes/x+/quote+/methods+/operation.parameter.delete.$id.tsxnew file mode 100644index 0000000000..a598cfa228--- /dev/null+++ b/apps/erp/app/routes/x+/quote+/methods+/operation.parameter.delete.$id.tsx@@ -0,0 +1,38 @@+import { assertIsPost, error } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { flash } from "@carbon/auth/session.server";+import { json, type ActionFunctionArgs } from "@vercel/remix";+import { deleteQuoteOperationParameter } from "~/modules/sales";++export async function action({ request, params }: ActionFunctionArgs) {+ assertIsPost(request);+ const { client } = await requirePermissions(request, {+ delete: "parts",+ });++ const { id } = params;+ if (!id) {+ throw new Error("id not found");+ }++ const deleteOperationParameter = await deleteQuoteOperationParameter(+ client,+ id+ );+ if (deleteOperationParameter.error) {+ return json(+ {+ id: null,+ },+ await flash(+ request,+ error(+ deleteOperationParameter.error,+ "Failed to delete quote operation tool"+ )+ )+ );+ }++ return json({});+}diff --git a/apps/erp/app/routes/x+/quote+/methods+/operation.parameter.new.tsx b/apps/erp/app/routes/x+/quote+/methods+/operation.parameter.new.tsxnew file mode 100644index 0000000000..0dd3cb895f--- /dev/null+++ b/apps/erp/app/routes/x+/quote+/methods+/operation.parameter.new.tsx@@ -0,0 +1,55 @@+import { assertIsPost, error } from "@carbon/auth";+import { requirePermissions } from "@carbon/auth/auth.server";+import { flash } from "@carbon/auth/session.server";+import { validationError, validator } from "@carbon/form";+import { json, type ActionFunctionArgs } from "@vercel/remix";+import { upsertQuoteOperationParameter } from "~/modules/sales";+import { operationParameterValidator } from "~/modules/shared";++export async function action({ request }: ActionFunctionArgs) {+ assertIsPost(request);+ const { client, companyId, userId } = await requirePermissions(request, {+ create: "parts",+ });++ const formData = await request.formData();+ const validation = await validator(operationParameterValidator).validate(+ formData+ );++ if (validation.error) {+ return validationError(validation.error);+ }++ const insert = await upsertQuoteOperationParameter(client, {+ ...validation.data,+ companyId,+ createdBy: userId,+ });+ if (insert.error) {+ return json(+ {+ id: null,+ },+ await flash(+ request,+ error(insert.error, "Failed to insert quote operation parameter")+ )+ );+ }++ const quoteOperationParameterId = insert.data?.id;+ if (!quoteOperationParameterId) {+ return json(+ {+ id: null,+ },+ await flash(+ request,+ error(insert.error, "Failed to insert quote operation parameter")+ )+ );+ }++ return json({ id: quoteOperationParameterId });+}diff --git a/apps/erp/app/utils/path.ts b/apps/erp/app/utils/path.tsindex 08a380ac2f..6cb69adf5b 100644--- a/apps/erp/app/utils/path.ts+++ b/apps/erp/app/utils/path.ts@@ -312,6 +312,8 @@ export const path = {deleteJob: (id: string) => generatePath(`${x}/job/${id}/delete`),deleteJobMaterial: (jobId: string, id: string) =>generatePath(`${x}/job/methods/${jobId}/material/delete/${id}`),+ deleteJobOperationParameter: (id: string) =>+ generatePath(`${x}/job/methods/operation/parameter/delete/${id}`),deleteJobOperationTool: (id: string) =>generatePath(`${x}/job/methods/operation/tool/delete/${id}`),deleteMaterialForm: (id: string) =>@@ -320,6 +322,8 @@ export const path = {generatePath(`${x}/items/substances/delete/${id}`),deleteMethodMaterial: (id: string) =>generatePath(`${x}/items/methods/material/delete/${id}`),+ deleteMethodOperationParameter: (id: string) =>+ generatePath(`${x}/items/methods/operation/parameter/delete/${id}`),deleteMethodOperationTool: (id: string) =>generatePath(`${x}/items/methods/operation/tool/delete/${id}`),deleteNoQuoteReason: (id: string) =>@@ -352,6 +356,8 @@ export const path = {generatePath(`${x}/quote/methods/${quoteId}/${lineId}/material/delete/${id}`),+ deleteQuoteOperationParameter: (id: string) =>+ generatePath(`${x}/quote/methods/operation/parameter/delete/${id}`),deleteQuoteOperationTool: (id: string) =>generatePath(`${x}/quote/methods/operation/tool/delete/${id}`),deleteReceipt: (id: string) => generatePath(`${x}/receipt/${id}/delete`),@@ -464,6 +470,8 @@ export const path = {jobOperations: (id: string) => generatePath(`${x}/job/${id}/operations`),jobOperationsOrder: `${x}/job/methods/operation/order`,jobOperationsDelete: `${x}/job/methods/operation/delete`,+ jobOperationParameter: (id: string) =>+ generatePath(`${x}/job/methods/operation/parameter/${id}`),jobOperationTool: (id: string) =>generatePath(`${x}/job/methods/operation/tool/${id}`),jobOperationStatus: `${x}/job/methods/operation/status`,@@ -518,6 +526,8 @@ export const path = {methodOperations: `${x}/items/methods/operations`,methodOperationsOrder: `${x}/items/methods/operation/order`,methodOperationsDelete: `${x}/items/methods/operation/delete`,+ methodOperationParameter: (id: string) =>+ generatePath(`${x}/items/methods/operation/parameter/${id}`),methodOperationTool: (id: string) =>generatePath(`${x}/items/methods/operation/tool/${id}`),newAbility: `${x}/resources/abilities/new`,@@ -565,12 +575,14 @@ export const path = {generatePath(`${x}/job/methods/${jobId}/material/new`),newJobOperation: (jobId: string) =>generatePath(`${x}/job/methods/${jobId}/operation/new`),+ newJobOperationParameter: `${x}/job/methods/operation/parameter/new`,newJobOperationTool: `${x}/job/methods/operation/tool/new`,newLocation: `${x}/resources/locations/new`,newMaterial: `${x}/material/new`,newMethodMaterial: `${x}/items/methods/material/new`,newMethodOperation: `${x}/items/methods/operation/new`,newMethodOperationTool: `${x}/items/methods/operation/tool/new`,+ newMethodOperationParameter: `${x}/items/methods/operation/parameter/new`,newNote: `${x}/shared/notes/new`,newPart: `${x}/part/new`,newItemPostingGroup: `${x}/items/groups/new`,@@ -596,6 +608,7 @@ export const path = {generatePath(`${x}/quote/${id}/${lineId}/cost/new`),newQuoteOperation: (quoteId: string, lineId: string) =>generatePath(`${x}/quote/methods/${quoteId}/${lineId}/operation/new`),+ newQuoteOperationParameter: `${x}/quote/methods/operation/parameter/new`,newQuoteOperationTool: `${x}/quote/methods/operation/tool/new`,newQuoteMaterial: (quoteId: string, lineId: string) =>generatePath(`${x}/quote/methods/${quoteId}/${lineId}/material/new`),@@ -774,6 +787,8 @@ export const path = {generatePath(`${x}/quote/methods/${quoteId}/${lineId}/operation/${id}`),quoteOperationsOrder: `${x}/quote/methods/operation/order`,quoteOperationsDelete: `${x}/quote/methods/operation/delete`,+ quoteOperationParameter: (id: string) =>+ generatePath(`${x}/quote/methods/operation/parameter/${id}`),quoteOperationTool: (id: string) =>generatePath(`${x}/quote/methods/operation/tool/${id}`),quotePayment: (id: string) => generatePath(`${x}/quote/${id}/payment`),diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.tsindex c07ad7d303..eaf62a42a6 100644--- a/packages/database/src/swagger-docs-schema.ts+++ b/packages/database/src/swagger-docs-schema.ts@@ -11130,6 +11130,9 @@ export default {{$ref: "#/parameters/rowFilter.company.logoLight",},+ {+ $ref: "#/parameters/rowFilter.company.slackChannel",+ },{$ref: "#/parameters/select",},@@ -11246,6 +11249,9 @@ export default {{$ref: "#/parameters/rowFilter.company.logoLight",},+ {+ $ref: "#/parameters/rowFilter.company.slackChannel",+ },{$ref: "#/parameters/preferReturn",},@@ -11316,6 +11322,9 @@ export default {{$ref: "#/parameters/rowFilter.company.logoLight",},+ {+ $ref: "#/parameters/rowFilter.company.slackChannel",+ },{$ref: "#/parameters/body.company",},@@ -18852,6 +18861,177 @@ export default {tags: ["accountCategories"],},},+ "/jobOperationParameter": {+ get: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.id",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.key",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.value",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.operationId",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.updatedBy",+ },+ {+ $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/jobOperationParameter",+ },+ type: "array",+ },+ },+ "206": {+ description: "Partial Content",+ },+ },+ tags: ["jobOperationParameter"],+ },+ post: {+ parameters: [+ {+ $ref: "#/parameters/body.jobOperationParameter",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/preferPost",+ },+ ],+ responses: {+ "201": {+ description: "Created",+ },+ },+ tags: ["jobOperationParameter"],+ },+ delete: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.id",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.key",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.value",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.operationId",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.updatedBy",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["jobOperationParameter"],+ },+ patch: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.id",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.key",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.value",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.operationId",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.jobOperationParameter.updatedBy",+ },+ {+ $ref: "#/parameters/body.jobOperationParameter",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["jobOperationParameter"],+ },+ },"/quotePayment": {get: {parameters: [@@ -33912,6 +34092,177 @@ export default {tags: ["documentFavorite"],},},+ "/quoteOperationParameter": {+ get: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.id",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.key",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.value",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.operationId",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.updatedBy",+ },+ {+ $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/quoteOperationParameter",+ },+ type: "array",+ },+ },+ "206": {+ description: "Partial Content",+ },+ },+ tags: ["quoteOperationParameter"],+ },+ post: {+ parameters: [+ {+ $ref: "#/parameters/body.quoteOperationParameter",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/preferPost",+ },+ ],+ responses: {+ "201": {+ description: "Created",+ },+ },+ tags: ["quoteOperationParameter"],+ },+ delete: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.id",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.key",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.value",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.operationId",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.updatedBy",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["quoteOperationParameter"],+ },+ patch: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.id",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.key",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.value",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.operationId",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.quoteOperationParameter.updatedBy",+ },+ {+ $ref: "#/parameters/body.quoteOperationParameter",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["quoteOperationParameter"],+ },+ },"/partner": {get: {parameters: [@@ -33975,7 +34326,190 @@ export default {description: "OK",schema: {items: {- $ref: "#/definitions/partner",+ $ref: "#/definitions/partner",+ },+ type: "array",+ },+ },+ "206": {+ description: "Partial Content",+ },+ },+ tags: ["partner"],+ },+ post: {+ parameters: [+ {+ $ref: "#/parameters/body.partner",+ },+ {+ $ref: "#/parameters/select",+ },+ {+ $ref: "#/parameters/preferPost",+ },+ ],+ responses: {+ "201": {+ description: "Created",+ },+ },+ tags: ["partner"],+ },+ delete: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.partner.id",+ },+ {+ $ref: "#/parameters/rowFilter.partner.hoursPerWeek",+ },+ {+ $ref: "#/parameters/rowFilter.partner.abilityId",+ },+ {+ $ref: "#/parameters/rowFilter.partner.active",+ },+ {+ $ref: "#/parameters/rowFilter.partner.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.partner.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.partner.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.partner.updatedBy",+ },+ {+ $ref: "#/parameters/rowFilter.partner.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.partner.customFields",+ },+ {+ $ref: "#/parameters/rowFilter.partner.tags",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["partner"],+ },+ patch: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.partner.id",+ },+ {+ $ref: "#/parameters/rowFilter.partner.hoursPerWeek",+ },+ {+ $ref: "#/parameters/rowFilter.partner.abilityId",+ },+ {+ $ref: "#/parameters/rowFilter.partner.active",+ },+ {+ $ref: "#/parameters/rowFilter.partner.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.partner.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.partner.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.partner.updatedBy",+ },+ {+ $ref: "#/parameters/rowFilter.partner.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.partner.customFields",+ },+ {+ $ref: "#/parameters/rowFilter.partner.tags",+ },+ {+ $ref: "#/parameters/body.partner",+ },+ {+ $ref: "#/parameters/preferReturn",+ },+ ],+ responses: {+ "204": {+ description: "No Content",+ },+ },+ tags: ["partner"],+ },+ },+ "/methodOperationParameter": {+ get: {+ parameters: [+ {+ $ref: "#/parameters/rowFilter.methodOperationParameter.id",+ },+ {+ $ref: "#/parameters/rowFilter.methodOperationParameter.key",+ },+ {+ $ref: "#/parameters/rowFilter.methodOperationParameter.value",+ },+ {+ $ref: "#/parameters/rowFilter.methodOperationParameter.operationId",+ },+ {+ $ref: "#/parameters/rowFilter.methodOperationParameter.companyId",+ },+ {+ $ref: "#/parameters/rowFilter.methodOperationParameter.createdAt",+ },+ {+ $ref: "#/parameters/rowFilter.methodOperationParameter.createdBy",+ },+ {+ $ref: "#/parameters/rowFilter.methodOperationParameter.updatedAt",+ },+ {+ $ref: "#/parameters/rowFilter.methodOperationParameter.updatedBy",+ },+ {+ $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/methodOperationParameter",},type: "array",},@@ -33984,12 +34518,12 @@ export default {description: "Partial Content",},},- tags: ["partner"],+ tags: ["methodOperationParameter"],},post: {parameters: [{- $ref: "#/parameters/body.partner",+ $ref: "#/parameters/body.methodOperationParameter",},{$ref: "#/parameters/select",@@ -34003,42 +34537,36 @@ export default {description: "Created",},},- tags: ["partner"],+ tags: ["methodOperationParameter"],},delete: {parameters: [{- $ref: "#/parameters/rowFilter.partner.id",+ $ref: "#/parameters/rowFilter.methodOperationParameter.id",},{- $ref: "#/parameters/rowFilter.partner.hoursPerWeek",+ $ref: "#/parameters/rowFilter.methodOperationParameter.key",},{- $ref: "#/parameters/rowFilter.partner.abilityId",+ $ref: "#/parameters/rowFilter.methodOperationParameter.value",},{- $ref: "#/parameters/rowFilter.partner.active",+ $ref: "#/parameters/rowFilter.methodOperationParameter.operationId",},{- $ref: "#/parameters/rowFilter.partner.companyId",+ $ref: "#/parameters/rowFilter.methodOperationParameter.companyId",},{- $ref: "#/parameters/rowFilter.partner.createdBy",- },- {- $ref: "#/parameters/rowFilter.partner.createdAt",+ $ref: "#/parameters/rowFilter.methodOperationParameter.createdAt",},{- $ref: "#/parameters/rowFilter.partner.updatedBy",- },- {- $ref: "#/parameters/rowFilter.partner.updatedAt",+ $ref: "#/parameters/rowFilter.methodOperationParameter.createdBy",},{- $ref: "#/parameters/rowFilter.partner.customFields",+ $ref: "#/parameters/rowFilter.methodOperationParameter.updatedAt",},{- $ref: "#/parameters/rowFilter.partner.tags",+ $ref: "#/parameters/rowFilter.methodOperationParameter.updatedBy",},{$ref: "#/parameters/preferReturn",@@ -34049,45 +34577,39 @@ export default {description: "No Content",},},- tags: ["partner"],+ tags: ["methodOperationParameter"],},patch: {parameters: [{- $ref: "#/parameters/rowFilter.partner.id",+ $ref: "#/parameters/rowFilter.methodOperationParameter.id",},{- $ref: "#/parameters/rowFilter.partner.hoursPerWeek",+ $ref: "#/parameters/rowFilter.methodOperationParameter.key",},{- $ref: "#/parameters/rowFilter.partner.abilityId",+ $ref: "#/parameters/rowFilter.methodOperationParameter.value",},{- $ref: "#/parameters/rowFilter.partner.active",+ $ref: "#/parameters/rowFilter.methodOperationParameter.operationId",},{- $ref: "#/parameters/rowFilter.partner.companyId",+ $ref: "#/parameters/rowFilter.methodOperationParameter.companyId",},{- $ref: "#/parameters/rowFilter.partner.createdBy",+ $ref: "#/parameters/rowFilter.methodOperationParameter.createdAt",},{- $ref: "#/parameters/rowFilter.partner.createdAt",- },- {- $ref: "#/parameters/rowFilter.partner.updatedBy",+ $ref: "#/parameters/rowFilter.methodOperationParameter.createdBy",},{- $ref: "#/parameters/rowFilter.partner.updatedAt",- },- {- $ref: "#/parameters/rowFilter.partner.customFields",+ $ref: "#/parameters/rowFilter.methodOperationParameter.updatedAt",},{- $ref: "#/parameters/rowFilter.partner.tags",+ $ref: "#/parameters/rowFilter.methodOperationParameter.updatedBy",},{- $ref: "#/parameters/body.partner",+ $ref: "#/parameters/body.methodOperationParameter",},{$ref: "#/parameters/preferReturn",@@ -34098,7 +34620,7 @@ export default {description: "No Content",},},- tags: ["partner"],+ tags: ["methodOperationParameter"],},},"/address": {@@ -50563,6 +51085,10 @@ export default {format: "text",type: "string",},+ slackChannel: {+ format: "text",+ type: "string",+ },},type: "object",},@@ -54128,6 +54654,65 @@ export default {},type: "object",},+ jobOperationParameter: {+ required: [+ "id",+ "key",+ "value",+ "operationId",+ "companyId",+ "createdAt",+ "createdBy",+ ],+ properties: {+ id: {+ default: "public.xid()",+ description: "Note:\nThis is a Primary Key.<pk/>",+ format: "text",+ type: "string",+ },+ key: {+ format: "text",+ type: "string",+ },+ value: {+ format: "text",+ type: "string",+ },+ operationId: {+ description:+ "Note:\nThis is a Foreign Key to `jobOperation.id`.<fk table='jobOperation' column='id'/>",+ format: "text",+ type: "string",+ },+ companyId: {+ format: "text",+ type: "string",+ },+ createdAt: {+ default: "now()",+ 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",+ },+ },+ type: "object",+ },quotePayment: {required: ["id", "companyId"],properties: {@@ -60812,11 +61397,158 @@ export default {},type: "object",},- unitOfMeasure: {+ unitOfMeasure: {+ required: [+ "id",+ "code",+ "name",+ "active",+ "companyId",+ "createdBy",+ "createdAt",+ ],+ properties: {+ id: {+ default: "public.xid()",+ description: "Note:\nThis is a Primary Key.<pk/>",+ format: "text",+ type: "string",+ },+ code: {+ format: "text",+ type: "string",+ },+ name: {+ format: "text",+ type: "string",+ },+ active: {+ default: true,+ format: "boolean",+ type: "boolean",+ },+ companyId: {+ description:+ "Note:\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",+ format: "text",+ type: "string",+ },+ createdBy: {+ description:+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",+ format: "text",+ type: "string",+ },+ createdAt: {+ default: "now()",+ 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",+ },+ updatedAt: {+ format: "timestamp with time zone",+ type: "string",+ },+ customFields: {+ format: "jsonb",+ },+ tags: {+ format: "text[]",+ items: {+ type: "string",+ },+ type: "array",+ },+ },+ type: "object",+ },+ documentFavorite: {+ required: ["documentId", "userId"],+ properties: {+ documentId: {+ description:+ "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `document.id`.<fk table='document' column='id'/>",+ format: "text",+ type: "string",+ },+ userId: {+ description:+ "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",+ format: "text",+ type: "string",+ },+ },+ type: "object",+ },+ quoteOperationParameter: {+ required: [+ "id",+ "key",+ "value",+ "operationId",+ "companyId",+ "createdAt",+ "createdBy",+ ],+ properties: {+ id: {+ default: "public.xid()",+ description: "Note:\nThis is a Primary Key.<pk/>",+ format: "text",+ type: "string",+ },+ key: {+ format: "text",+ type: "string",+ },+ value: {+ format: "text",+ type: "string",+ },+ operationId: {+ description:+ "Note:\nThis is a Foreign Key to `quoteOperation.id`.<fk table='quoteOperation' column='id'/>",+ format: "text",+ type: "string",+ },+ companyId: {+ format: "text",+ type: "string",+ },+ createdAt: {+ default: "now()",+ 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",+ },+ },+ type: "object",+ },+ partner: {required: ["id",- "code",- "name",+ "hoursPerWeek",+ "abilityId","active","companyId","createdBy",@@ -60824,16 +61556,19 @@ export default {],properties: {id: {- default: "public.xid()",- description: "Note:\nThis is a Primary Key.<pk/>",+ description:+ "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `supplierLocation.id`.<fk table='supplierLocation' column='id'/>",format: "text",type: "string",},- code: {- format: "text",- type: "string",+ hoursPerWeek: {+ default: 0,+ format: "integer",+ type: "integer",},- name: {+ abilityId: {+ description:+ "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `ability.id`.<fk table='ability' column='id'/>",format: "text",type: "string",},@@ -60882,66 +61617,38 @@ export default {},type: "object",},- documentFavorite: {- required: ["documentId", "userId"],- properties: {- documentId: {- description:- "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `document.id`.<fk table='document' column='id'/>",- format: "text",- type: "string",- },- userId: {- description:- "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",- format: "text",- type: "string",- },- },- type: "object",- },- partner: {+ methodOperationParameter: {required: ["id",- "hoursPerWeek",- "abilityId",- "active",+ "key",+ "value",+ "operationId","companyId",- "createdBy","createdAt",+ "createdBy",],properties: {id: {- description:- "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `supplierLocation.id`.<fk table='supplierLocation' column='id'/>",+ default: "public.xid()",+ description: "Note:\nThis is a Primary Key.<pk/>",format: "text",type: "string",},- hoursPerWeek: {- default: 0,- format: "integer",- type: "integer",- },- abilityId: {- description:- "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `ability.id`.<fk table='ability' column='id'/>",+ key: {format: "text",type: "string",},- active: {- default: true,- format: "boolean",- type: "boolean",+ value: {+ format: "text",+ type: "string",},- companyId: {+ operationId: {description:- "Note:\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",+ "Note:\nThis is a Foreign Key to `methodOperation.id`.<fk table='methodOperation' column='id'/>",format: "text",type: "string",},- createdBy: {- description:- "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",+ companyId: {format: "text",type: "string",},@@ -60950,7 +61657,7 @@ export default {format: "timestamp with time zone",type: "string",},- updatedBy: {+ createdBy: {description:"Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",format: "text",@@ -60960,15 +61667,11 @@ export default {format: "timestamp with time zone",type: "string",},- customFields: {- format: "jsonb",- },- tags: {- format: "text[]",- items: {- type: "string",- },- type: "array",+ updatedBy: {+ description:+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",+ format: "text",+ type: "string",},},type: "object",@@ -71346,6 +72049,13 @@ export default {in: "query",type: "string",},+ "rowFilter.company.slackChannel": {+ name: "slackChannel",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },"body.jobOperationTool": {name: "jobOperationTool",description: "jobOperationTool",@@ -76128,6 +76838,78 @@ export default {in: "query",type: "string",},+ "body.jobOperationParameter": {+ name: "jobOperationParameter",+ description: "jobOperationParameter",+ required: false,+ in: "body",+ schema: {+ $ref: "#/definitions/jobOperationParameter",+ },+ },+ "rowFilter.jobOperationParameter.id": {+ name: "id",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.jobOperationParameter.key": {+ name: "key",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.jobOperationParameter.value": {+ name: "value",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.jobOperationParameter.operationId": {+ name: "operationId",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.jobOperationParameter.companyId": {+ name: "companyId",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.jobOperationParameter.createdAt": {+ name: "createdAt",+ required: false,+ format: "timestamp with time zone",+ in: "query",+ type: "string",+ },+ "rowFilter.jobOperationParameter.createdBy": {+ name: "createdBy",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.jobOperationParameter.updatedAt": {+ name: "updatedAt",+ required: false,+ format: "timestamp with time zone",+ in: "query",+ type: "string",+ },+ "rowFilter.jobOperationParameter.updatedBy": {+ name: "updatedBy",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },"body.quotePayment": {name: "quotePayment",description: "quotePayment",@@ -84873,6 +85655,78 @@ export default {in: "query",type: "string",},+ "body.quoteOperationParameter": {+ name: "quoteOperationParameter",+ description: "quoteOperationParameter",+ required: false,+ in: "body",+ schema: {+ $ref: "#/definitions/quoteOperationParameter",+ },+ },+ "rowFilter.quoteOperationParameter.id": {+ name: "id",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.quoteOperationParameter.key": {+ name: "key",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.quoteOperationParameter.value": {+ name: "value",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.quoteOperationParameter.operationId": {+ name: "operationId",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.quoteOperationParameter.companyId": {+ name: "companyId",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.quoteOperationParameter.createdAt": {+ name: "createdAt",+ required: false,+ format: "timestamp with time zone",+ in: "query",+ type: "string",+ },+ "rowFilter.quoteOperationParameter.createdBy": {+ name: "createdBy",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.quoteOperationParameter.updatedAt": {+ name: "updatedAt",+ required: false,+ format: "timestamp with time zone",+ in: "query",+ type: "string",+ },+ "rowFilter.quoteOperationParameter.updatedBy": {+ name: "updatedBy",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },"body.partner": {name: "partner",description: "partner",@@ -84959,6 +85813,78 @@ export default {in: "query",type: "string",},+ "body.methodOperationParameter": {+ name: "methodOperationParameter",+ description: "methodOperationParameter",+ required: false,+ in: "body",+ schema: {+ $ref: "#/definitions/methodOperationParameter",+ },+ },+ "rowFilter.methodOperationParameter.id": {+ name: "id",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.methodOperationParameter.key": {+ name: "key",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.methodOperationParameter.value": {+ name: "value",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.methodOperationParameter.operationId": {+ name: "operationId",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.methodOperationParameter.companyId": {+ name: "companyId",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.methodOperationParameter.createdAt": {+ name: "createdAt",+ required: false,+ format: "timestamp with time zone",+ in: "query",+ type: "string",+ },+ "rowFilter.methodOperationParameter.createdBy": {+ name: "createdBy",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },+ "rowFilter.methodOperationParameter.updatedAt": {+ name: "updatedAt",+ required: false,+ format: "timestamp with time zone",+ in: "query",+ type: "string",+ },+ "rowFilter.methodOperationParameter.updatedBy": {+ name: "updatedBy",+ required: false,+ format: "text",+ in: "query",+ type: "string",+ },"body.address": {name: "address",description: "address",diff --git a/packages/database/src/types.ts b/packages/database/src/types.tsindex c25af4dd69..c4eebcb871 100644--- a/packages/database/src/types.ts+++ b/packages/database/src/types.ts@@ -9223,6 +9223,127 @@ export type Database = {},]}+ jobOperationParameter: {+ Row: {+ companyId: string+ createdAt: string+ createdBy: string+ id: string+ key: string+ operationId: string+ updatedAt: string | null+ updatedBy: string | null+ value: string+ }+ Insert: {+ companyId: string+ createdAt?: string+ createdBy: string+ id?: string+ key: string+ operationId: string+ updatedAt?: string | null+ updatedBy?: string | null+ value: string+ }+ Update: {+ companyId?: string+ createdAt?: string+ createdBy?: string+ id?: string+ key?: string+ operationId?: string+ updatedAt?: string | null+ updatedBy?: string | null+ value?: string+ }+ Relationships: [+ {+ foreignKeyName: "jobOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "jobOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "jobOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "jobOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "jobOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "jobOperationParameter_operationId_fkey"+ columns: ["operationId"]+ isOneToOne: false+ referencedRelation: "jobOperation"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "jobOperationParameter_operationId_fkey"+ columns: ["operationId"]+ isOneToOne: false+ referencedRelation: "jobOperationsWithMakeMethods"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "jobOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "jobOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "jobOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "jobOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "jobOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ ]+ }jobOperationTool: {Row: {companyId: string@@ -10787,6 +10908,120 @@ export type Database = {},]}+ methodOperationParameter: {+ Row: {+ companyId: string+ createdAt: string+ createdBy: string+ id: string+ key: string+ operationId: string+ updatedAt: string | null+ updatedBy: string | null+ value: string+ }+ Insert: {+ companyId: string+ createdAt?: string+ createdBy: string+ id?: string+ key: string+ operationId: string+ updatedAt?: string | null+ updatedBy?: string | null+ value: string+ }+ Update: {+ companyId?: string+ createdAt?: string+ createdBy?: string+ id?: string+ key?: string+ operationId?: string+ updatedAt?: string | null+ updatedBy?: string | null+ value?: string+ }+ Relationships: [+ {+ foreignKeyName: "methodOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "methodOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "methodOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "methodOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "methodOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "methodOperationParameter_operationId_fkey"+ columns: ["operationId"]+ isOneToOne: false+ referencedRelation: "methodOperation"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "methodOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "methodOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "methodOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "methodOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "methodOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ ]+ }methodOperationTool: {Row: {companyId: string@@ -17518,6 +17753,127 @@ export type Database = {},]}+ quoteOperationParameter: {+ Row: {+ companyId: string+ createdAt: string+ createdBy: string+ id: string+ key: string+ operationId: string+ updatedAt: string | null+ updatedBy: string | null+ value: string+ }+ Insert: {+ companyId: string+ createdAt?: string+ createdBy: string+ id?: string+ key: string+ operationId: string+ updatedAt?: string | null+ updatedBy?: string | null+ value: string+ }+ Update: {+ companyId?: string+ createdAt?: string+ createdBy?: string+ id?: string+ key?: string+ operationId?: string+ updatedAt?: string | null+ updatedBy?: string | null+ value?: string+ }+ Relationships: [+ {+ foreignKeyName: "quoteOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "quoteOperationParameter_operationId_fkey"+ columns: ["operationId"]+ isOneToOne: false+ referencedRelation: "quoteOperation"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteOperationParameter_operationId_fkey"+ columns: ["operationId"]+ isOneToOne: false+ referencedRelation: "quoteOperationsWithMakeMethods"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ ]+ }quoteOperationTool: {Row: {companyId: string@@ -28796,14 +29152,14 @@ export type Database = {},{foreignKeyName: "partner_id_fkey"- columns: ["supplierLocationId"]+ columns: ["id"]isOneToOne: falsereferencedRelation: "supplierLocation"referencedColumns: ["id"]},{foreignKeyName: "partner_id_fkey"- columns: ["id"]+ columns: ["supplierLocationId"]isOneToOne: falsereferencedRelation: "supplierLocation"referencedColumns: ["id"]@@ -31652,14 +32008,14 @@ export type Database = {Relationships: [{foreignKeyName: "address_countryCode_fkey"- columns: ["paymentCountryCode"]+ columns: ["customerCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]},{foreignKeyName: "address_countryCode_fkey"- columns: ["customerCountryCode"]+ columns: ["paymentCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]diff --git a/packages/database/supabase/functions/get-method/index.ts b/packages/database/supabase/functions/get-method/index.tsindex e3eb6ef33f..90c7131827 100644--- a/packages/database/supabase/functions/get-method/index.ts+++ b/packages/database/supabase/functions/get-method/index.ts@@ -91,9 +91,7 @@ serve(async (req: Request) => {.eq("makeMethodId", sourceMakeMethod.data.id),client.from("methodOperation")- .select(- "*, methodOperationTool(id, operationId, toolId, quantity, createdBy, createdAt, updatedBy, updatedAt)"- )+ .select("*, methodOperationTool(*), methodOperationParameter(*)").eq("makeMethodId", sourceMakeMethod.data.id),]);@@ -151,7 +149,8 @@ serve(async (req: Request) => {index,operation,] of sourceOperations.data.entries()) {- const { methodOperationTool } = operation;+ const { methodOperationTool, methodOperationParameter } =+ operation;const operationId = operationIds[index].id;if (@@ -172,6 +171,24 @@ serve(async (req: Request) => {).execute();}++ if (+ Array.isArray(methodOperationParameter) &&+ methodOperationParameter.length > 0+ ) {+ await trx+ .insertInto("methodOperationParameter")+ .values(+ methodOperationParameter.map((param) => ({+ operationId: operationId!,+ key: param.key,+ value: param.value,+ companyId,+ createdBy: userId,+ }))+ )+ .execute();+ }}}});@@ -272,12 +289,13 @@ serve(async (req: Request) => {field: string;defaultValue: T;}): Promise<T> {- const configurationKey = `${id}:${field}`;+ if (!configurationCodeByField) return defaultValue;+ const fieldKey = getFieldKey(field, id);- if (configurationCodeByField?.[configurationKey]) {+ if (configurationCodeByField?.[fieldKey]) {try {const mod = await importTypeScript(- configurationCodeByField[configurationKey]+ configurationCodeByField[fieldKey]);const result = await mod.configure(configuration);return (result ?? defaultValue) as T;@@ -304,9 +322,7 @@ serve(async (req: Request) => {const relatedOperations = await client.from("methodOperation")- .select(- "*, methodOperationTool(id, operationId, toolId, quantity, createdBy, createdAt, updatedBy, updatedAt)"- )+ .select("*, methodOperationTool(*), methodOperationParameter(*)").eq("makeMethodId", node.data.materialMakeMethodId);let jobOperationsInserts: Database["public"]["Tables"]["jobOperation"]["Insert"][] =@@ -451,7 +467,9 @@ serve(async (req: Request) => {const operationId = operationIds[index].id;if (operationId) {- const { methodOperationTool } = operation;+ const { methodOperationTool, methodOperationParameter } =+ operation;+if (Array.isArray(methodOperationTool) &&methodOperationTool.length > 0@@ -469,6 +487,30 @@ serve(async (req: Request) => {).execute();}++ if (+ Array.isArray(methodOperationParameter) &&+ methodOperationParameter.length > 0+ ) {+ const parameters = await Promise.all(+ methodOperationParameter.map(async (param) => ({+ operationId,+ key: param.key,+ value: await getConfiguredValue({+ id: operation.id,+ field: `parameter:${param.id}:value`,+ defaultValue: param.value,+ }),+ companyId,+ createdBy: userId,+ }))+ );++ await trx+ .insertInto("jobOperationParameter")+ .values(parameters)+ .execute();+ }}}@@ -722,9 +764,7 @@ serve(async (req: Request) => {) {const relatedOperations = await client.from("methodOperation")- .select(- "*, methodOperationTool(id, operationId, toolId, quantity, createdBy, createdAt, updatedBy, updatedAt)"- )+ .select("*, methodOperationTool(*), methodOperationParameter(*)").eq("makeMethodId", node.data.materialMakeMethodId);const jobOperationsInserts =@@ -770,7 +810,8 @@ serve(async (req: Request) => {const operationId = operationIds[index].id;if (operationId) {- const { methodOperationTool } = operation;+ const { methodOperationTool, methodOperationParameter } =+ operation;if (Array.isArray(methodOperationTool) &&methodOperationTool.length > 0@@ -788,6 +829,24 @@ serve(async (req: Request) => {).execute();}++ if (+ Array.isArray(methodOperationParameter) &&+ methodOperationParameter.length > 0+ ) {+ await trx+ .insertInto("jobOperationParameter")+ .values(+ methodOperationParameter.map((param) => ({+ operationId,+ key: param.key,+ value: param.value,+ companyId,+ createdBy: userId,+ }))+ )+ .execute();+ }}}@@ -978,6 +1037,7 @@ serve(async (req: Request) => {if (!configurationCodeByField) return defaultValue;const fieldKey = getFieldKey(field, id);+if (configurationCodeByField[fieldKey]) {try {const code = configurationCodeByField[fieldKey];@@ -1004,9 +1064,7 @@ serve(async (req: Request) => {) {const relatedOperations = await client.from("methodOperation")- .select(- "*, methodOperationTool(id, operationId, toolId, quantity, createdBy, createdAt, updatedBy, updatedAt)"- )+ .select("*, methodOperationTool(*), methodOperationParameter(*)").eq("makeMethodId", node.data.materialMakeMethodId);let quoteOperationsInserts: Database["public"]["Tables"]["quoteOperation"]["Insert"][] =@@ -1157,7 +1215,9 @@ serve(async (req: Request) => {const operationId = operationIds[index].id;if (operationId) {- const { methodOperationTool } = operation;+ const { methodOperationTool, methodOperationParameter } =+ operation;+if (Array.isArray(methodOperationTool) &&methodOperationTool.length > 0@@ -1175,6 +1235,30 @@ serve(async (req: Request) => {).execute();}++ if (+ Array.isArray(methodOperationParameter) &&+ methodOperationParameter.length > 0+ ) {+ const parameters = await Promise.all(+ methodOperationParameter.map(async (param) => ({+ operationId,+ key: param.key,+ value: await getConfiguredValue({+ id: operation.id,+ field: `parameter:${param.id}:value`,+ defaultValue: param.value,+ }),+ companyId,+ createdBy: userId,+ }))+ );++ await trx+ .insertInto("quoteOperationParameter")+ .values(parameters)+ .execute();+ }}}@@ -1431,9 +1515,7 @@ serve(async (req: Request) => {) {const relatedOperations = await client.from("methodOperation")- .select(- "*, methodOperationTool(id, operationId, toolId, quantity, createdBy, createdAt, updatedBy, updatedAt)"- )+ .select("*, methodOperationTool(*), methodOperationParameter(*)").eq("makeMethodId", node.data.materialMakeMethodId);const quoteOperationInserts =@@ -1480,7 +1562,8 @@ serve(async (req: Request) => {const operationId = operationIds[index].id;if (operationId) {- const { methodOperationTool } = operation;+ const { methodOperationTool, methodOperationParameter } =+ operation;if (Array.isArray(methodOperationTool) &&methodOperationTool.length > 0@@ -1498,6 +1581,24 @@ serve(async (req: Request) => {).execute();}++ if (+ Array.isArray(methodOperationParameter) &&+ methodOperationParameter.length > 0+ ) {+ await trx+ .insertInto("quoteOperationParameter")+ .values(+ methodOperationParameter.map((param) => ({+ operationId,+ key: param.key,+ value: param.value,+ companyId,+ createdBy: userId,+ }))+ )+ .execute();+ }}}@@ -1610,9 +1711,7 @@ serve(async (req: Request) => {const [jobOperations] = await Promise.all([client.from("jobOperationsWithMakeMethods")- .select(- "*, jobOperationTool(id, operationId, toolId, quantity, createdBy, createdAt, updatedBy, updatedAt)"- )+ .select("*, jobOperationTool(*), jobOperationParameter(*)").eq("jobId", jobMakeMethod.data.jobId),]);@@ -1773,7 +1872,8 @@ serve(async (req: Request) => {).entries()) {const operationId = operationIds[index].id;if (operationId) {- const { jobOperationTool } = operation;+ const { jobOperationTool, jobOperationParameter } = operation;+if (Array.isArray(jobOperationTool) &&jobOperationTool.length > 0@@ -1791,6 +1891,24 @@ serve(async (req: Request) => {).execute();}++ if (+ Array.isArray(jobOperationParameter) &&+ jobOperationParameter.length > 0+ ) {+ await trx+ .insertInto("methodOperationParameter")+ .values(+ jobOperationParameter.map((param) => ({+ operationId,+ key: param.key,+ value: param.value,+ companyId,+ createdBy: userId,+ }))+ )+ .execute();+ }}}}@@ -1815,9 +1933,7 @@ serve(async (req: Request) => {.single(),client.from("jobOperationsWithMakeMethods")- .select(- "*, jobOperationTool(id, operationId, toolId, quantity, createdBy, createdAt, updatedBy, updatedAt)"- )+ .select("*, jobOperationTool(*), jobOperationParameter(*)").eq("jobId", jobId),]);@@ -1979,7 +2095,8 @@ serve(async (req: Request) => {).entries()) {const operationId = operationIds[index].id;if (operationId) {- const { jobOperationTool } = operation;+ const { jobOperationTool, jobOperationParameter } = operation;+if (Array.isArray(jobOperationTool) &&jobOperationTool.length > 0@@ -1997,6 +2114,24 @@ serve(async (req: Request) => {).execute();}++ if (+ Array.isArray(jobOperationParameter) &&+ jobOperationParameter.length > 0+ ) {+ await trx+ .insertInto("methodOperationParameter")+ .values(+ jobOperationParameter.map((param) => ({+ operationId,+ key: param.key,+ value: param.value,+ companyId,+ createdBy: userId,+ }))+ )+ .execute();+ }}}}@@ -2022,9 +2157,7 @@ serve(async (req: Request) => {.single(),client.from("quoteOperationsWithMakeMethods")- .select(- "*, quoteOperationTool(id, operationId, toolId, quantity, createdBy, createdAt, updatedBy, updatedAt)"- )+ .select("*, quoteOperationTool(*), quoteOperationParameter(*)").eq("quoteLineId", quoteLineId),]);@@ -2193,7 +2326,9 @@ serve(async (req: Request) => {).entries()) {const operationId = operationIds[index].id;if (operationId) {- const { quoteOperationTool } = operation;+ const { quoteOperationTool, quoteOperationParameter } =+ operation;+if (Array.isArray(quoteOperationTool) &"eOperationTool.length > 0@@ -2211,6 +2346,24 @@ serve(async (req: Request) => {).execute();}++ if (+ Array.isArray(quoteOperationParameter) &&+ quoteOperationParameter.length > 0+ ) {+ await trx+ .insertInto("methodOperationParameter")+ .values(+ quoteOperationParameter.map((param) => ({+ operationId,+ key: param.key,+ value: param.value,+ companyId,+ createdBy: userId,+ }))+ )+ .execute();+ }}}}@@ -2253,9 +2406,7 @@ serve(async (req: Request) => {.eq("quoteLineId", quoteLineId),client.from("quoteOperation")- .select(- "*, quoteOperationTool(id, operationId, toolId, quantity, createdBy, createdAt, updatedBy, updatedAt)"- )+ .select("*, quoteOperationTool(*), quoteOperationParameter(*)").eq("quoteLineId", quoteLineId),]);@@ -2415,7 +2566,9 @@ serve(async (req: Request) => {).entries()) {const operationId = operationIds[index].id;if (operationId) {- const { quoteOperationTool } = operation;+ const { quoteOperationTool, quoteOperationParameter } =+ operation;+if (Array.isArray(quoteOperationTool) &"eOperationTool.length > 0@@ -2433,6 +2586,24 @@ serve(async (req: Request) => {).execute();}++ if (+ Array.isArray(quoteOperationParameter) &&+ quoteOperationParameter.length > 0+ ) {+ await trx+ .insertInto("jobOperationParameter")+ .values(+ quoteOperationParameter.map((param) => ({+ operationId,+ key: param.key,+ value: param.value,+ companyId,+ createdBy: userId,+ }))+ )+ .execute();+ }}}}@@ -2464,9 +2635,7 @@ serve(async (req: Request) => {const [quoteOperations] = await Promise.all([client.from("quoteOperationsWithMakeMethods")- .select(- "*, quoteOperationTool(id, operationId, toolId, quantity, createdBy, createdAt, updatedBy, updatedAt)"- )+ .select("*, quoteOperationTool(*), quoteOperationParameter(*)").eq("quoteLineId", quoteMakeMethod.data.quoteLineId),]);@@ -2631,7 +2800,9 @@ serve(async (req: Request) => {).entries()) {const operationId = operationIds[index].id;if (operationId) {- const { quoteOperationTool } = operation;+ const { quoteOperationTool, quoteOperationParameter } =+ operation;+if (Array.isArray(quoteOperationTool) &"eOperationTool.length > 0@@ -2649,6 +2820,24 @@ serve(async (req: Request) => {).execute();}++ if (+ Array.isArray(quoteOperationParameter) &&+ quoteOperationParameter.length > 0+ ) {+ await trx+ .insertInto("methodOperationParameter")+ .values(+ quoteOperationParameter.map((param) => ({+ operationId,+ key: param.key,+ value: param.value,+ companyId,+ createdBy: userId,+ }))+ )+ .execute();+ }}}}diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.tsindex c25af4dd69..c4eebcb871 100644--- a/packages/database/supabase/functions/lib/types.ts+++ b/packages/database/supabase/functions/lib/types.ts@@ -9223,6 +9223,127 @@ export type Database = {},]}+ jobOperationParameter: {+ Row: {+ companyId: string+ createdAt: string+ createdBy: string+ id: string+ key: string+ operationId: string+ updatedAt: string | null+ updatedBy: string | null+ value: string+ }+ Insert: {+ companyId: string+ createdAt?: string+ createdBy: string+ id?: string+ key: string+ operationId: string+ updatedAt?: string | null+ updatedBy?: string | null+ value: string+ }+ Update: {+ companyId?: string+ createdAt?: string+ createdBy?: string+ id?: string+ key?: string+ operationId?: string+ updatedAt?: string | null+ updatedBy?: string | null+ value?: string+ }+ Relationships: [+ {+ foreignKeyName: "jobOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "jobOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "jobOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "jobOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "jobOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "jobOperationParameter_operationId_fkey"+ columns: ["operationId"]+ isOneToOne: false+ referencedRelation: "jobOperation"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "jobOperationParameter_operationId_fkey"+ columns: ["operationId"]+ isOneToOne: false+ referencedRelation: "jobOperationsWithMakeMethods"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "jobOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "jobOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "jobOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "jobOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "jobOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ ]+ }jobOperationTool: {Row: {companyId: string@@ -10787,6 +10908,120 @@ export type Database = {},]}+ methodOperationParameter: {+ Row: {+ companyId: string+ createdAt: string+ createdBy: string+ id: string+ key: string+ operationId: string+ updatedAt: string | null+ updatedBy: string | null+ value: string+ }+ Insert: {+ companyId: string+ createdAt?: string+ createdBy: string+ id?: string+ key: string+ operationId: string+ updatedAt?: string | null+ updatedBy?: string | null+ value: string+ }+ Update: {+ companyId?: string+ createdAt?: string+ createdBy?: string+ id?: string+ key?: string+ operationId?: string+ updatedAt?: string | null+ updatedBy?: string | null+ value?: string+ }+ Relationships: [+ {+ foreignKeyName: "methodOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "methodOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "methodOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "methodOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "methodOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "methodOperationParameter_operationId_fkey"+ columns: ["operationId"]+ isOneToOne: false+ referencedRelation: "methodOperation"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "methodOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "methodOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "methodOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "methodOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "methodOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ ]+ }methodOperationTool: {Row: {companyId: string@@ -17518,6 +17753,127 @@ export type Database = {},]}+ quoteOperationParameter: {+ Row: {+ companyId: string+ createdAt: string+ createdBy: string+ id: string+ key: string+ operationId: string+ updatedAt: string | null+ updatedBy: string | null+ value: string+ }+ Insert: {+ companyId: string+ createdAt?: string+ createdBy: string+ id?: string+ key: string+ operationId: string+ updatedAt?: string | null+ updatedBy?: string | null+ value: string+ }+ Update: {+ companyId?: string+ createdAt?: string+ createdBy?: string+ id?: string+ key?: string+ operationId?: string+ updatedAt?: string | null+ updatedBy?: string | null+ value?: string+ }+ Relationships: [+ {+ foreignKeyName: "quoteOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteOperationParameter_createdBy_fkey"+ columns: ["createdBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ {+ foreignKeyName: "quoteOperationParameter_operationId_fkey"+ columns: ["operationId"]+ isOneToOne: false+ referencedRelation: "quoteOperation"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteOperationParameter_operationId_fkey"+ columns: ["operationId"]+ isOneToOne: false+ referencedRelation: "quoteOperationsWithMakeMethods"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employees"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeesAcrossCompanies"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "employeeSummary"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "user"+ referencedColumns: ["id"]+ },+ {+ foreignKeyName: "quoteOperationParameter_updatedBy_fkey"+ columns: ["updatedBy"]+ isOneToOne: false+ referencedRelation: "userDefaults"+ referencedColumns: ["userId"]+ },+ ]+ }quoteOperationTool: {Row: {companyId: string@@ -28796,14 +29152,14 @@ export type Database = {},{foreignKeyName: "partner_id_fkey"- columns: ["supplierLocationId"]+ columns: ["id"]isOneToOne: falsereferencedRelation: "supplierLocation"referencedColumns: ["id"]},{foreignKeyName: "partner_id_fkey"- columns: ["id"]+ columns: ["supplierLocationId"]isOneToOne: falsereferencedRelation: "supplierLocation"referencedColumns: ["id"]@@ -31652,14 +32008,14 @@ export type Database = {Relationships: [{foreignKeyName: "address_countryCode_fkey"- columns: ["paymentCountryCode"]+ columns: ["customerCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]},{foreignKeyName: "address_countryCode_fkey"- columns: ["customerCountryCode"]+ columns: ["paymentCountryCode"]isOneToOne: falsereferencedRelation: "country"referencedColumns: ["alpha2"]diff --git a/packages/database/supabase/migrations/20250215102137_process-parameters.sql b/packages/database/supabase/migrations/20250215102137_process-parameters.sqlnew file mode 100644index 0000000000..9db7ce4402--- /dev/null+++ b/packages/database/supabase/migrations/20250215102137_process-parameters.sql@@ -0,0 +1,189 @@+CREATE TABLE "methodOperationParameter" (+ "id" TEXT NOT NULL DEFAULT xid(),+ "key" TEXT NOT NULL,+ "value" TEXT NOT NULL,+ "operationId" TEXT NOT NULL,+ "companyId" TEXT NOT NULL,+ "createdAt" TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,+ "createdBy" TEXT NOT NULL,+ "updatedAt" TIMESTAMP WITH TIME ZONE,+ "updatedBy" TEXT,++ CONSTRAINT "methodOperationParameter_pkey" PRIMARY KEY ("id"),+ CONSTRAINT "methodOperationParameter_operationId_fkey" FOREIGN KEY ("operationId") REFERENCES "methodOperation"("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "methodOperationParameter_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user"("id") ON UPDATE CASCADE,+ CONSTRAINT "methodOperationParameter_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user"("id") ON UPDATE CASCADE+);++CREATE INDEX "methodOperationParameter_companyId_idx" ON "methodOperationParameter"("companyId");+CREATE INDEX "methodOperationParameter_operationId_idx" ON "methodOperationParameter"("operationId");++ALTER TABLE "methodOperationParameter" ENABLE ROW LEVEL SECURITY;+++CREATE POLICY "SELECT" ON "public"."methodOperationParameter"+FOR SELECT USING (+ "companyId" = ANY (+ (+ SELECT+ get_companies_with_employee_role()+ )::text[]+ )+);++CREATE POLICY "INSERT" ON "public"."methodOperationParameter"+FOR INSERT WITH CHECK (+ "companyId" = ANY (+ (+ SELECT+ get_companies_with_employee_permission ('parts_create')+ )::text[]+ )+);++CREATE POLICY "UPDATE" ON "public"."methodOperationParameter"+FOR UPDATE USING (+ "companyId" = ANY (+ (+ SELECT+ get_companies_with_employee_permission ('parts_update')+ )::text[]+ )+);++CREATE POLICY "DELETE" ON "public"."methodOperationParameter"+FOR DELETE USING (+ "companyId" = ANY (+ (+ SELECT+ get_companies_with_employee_permission ('parts_delete')+ )::text[]+ )+);++CREATE TABLE "quoteOperationParameter" (+ "id" TEXT NOT NULL DEFAULT xid(),+ "key" TEXT NOT NULL,+ "value" TEXT NOT NULL,+ "operationId" TEXT NOT NULL,+ "companyId" TEXT NOT NULL,+ "createdAt" TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,+ "createdBy" TEXT NOT NULL,+ "updatedAt" TIMESTAMP WITH TIME ZONE,+ "updatedBy" TEXT,++ CONSTRAINT "quoteOperationParameter_pkey" PRIMARY KEY ("id"),+ CONSTRAINT "quoteOperationParameter_operationId_fkey" FOREIGN KEY ("operationId") REFERENCES "quoteOperation"("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "quoteOperationParameter_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user"("id") ON UPDATE CASCADE,+ CONSTRAINT "quoteOperationParameter_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user"("id") ON UPDATE CASCADE+);++CREATE INDEX "quoteOperationParameter_companyId_idx" ON "quoteOperationParameter"("companyId");+CREATE INDEX "quoteOperationParameter_operationId_idx" ON "quoteOperationParameter"("operationId");++ALTER TABLE "quoteOperationParameter" ENABLE ROW LEVEL SECURITY;+++CREATE POLICY "SELECT" ON "public"."quoteOperationParameter"+FOR SELECT USING (+ "companyId" = ANY (+ (+ SELECT+ get_companies_with_employee_role()+ )::text[]+ )+);++CREATE POLICY "INSERT" ON "public"."quoteOperationParameter"+FOR INSERT WITH CHECK (+ "companyId" = ANY (+ (+ SELECT+ get_companies_with_employee_permission ('parts_create')+ )::text[]+ )+);++CREATE POLICY "UPDATE" ON "public"."quoteOperationParameter"+FOR UPDATE USING (+ "companyId" = ANY (+ (+ SELECT+ get_companies_with_employee_permission ('parts_update')+ )::text[]+ )+);++CREATE POLICY "DELETE" ON "public"."quoteOperationParameter"+FOR DELETE USING (+ "companyId" = ANY (+ (+ SELECT+ get_companies_with_employee_permission ('parts_delete')+ )::text[]+ )+);+++CREATE TABLE "jobOperationParameter" (+ "id" TEXT NOT NULL DEFAULT xid(),+ "key" TEXT NOT NULL,+ "value" TEXT NOT NULL,+ "operationId" TEXT NOT NULL,+ "companyId" TEXT NOT NULL,+ "createdAt" TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,+ "createdBy" TEXT NOT NULL,+ "updatedAt" TIMESTAMP WITH TIME ZONE,+ "updatedBy" TEXT,++ CONSTRAINT "jobOperationParameter_pkey" PRIMARY KEY ("id"),+ CONSTRAINT "jobOperationParameter_operationId_fkey" FOREIGN KEY ("operationId") REFERENCES "jobOperation"("id") ON DELETE CASCADE ON UPDATE CASCADE,+ CONSTRAINT "jobOperationParameter_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user"("id") ON UPDATE CASCADE,+ CONSTRAINT "jobOperationParameter_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user"("id") ON UPDATE CASCADE+);++CREATE INDEX "jobOperationParameter_companyId_idx" ON "jobOperationParameter"("companyId");+CREATE INDEX "jobOperationParameter_operationId_idx" ON "jobOperationParameter"("operationId");++ALTER TABLE "jobOperationParameter" ENABLE ROW LEVEL SECURITY;+++CREATE POLICY "SELECT" ON "public"."jobOperationParameter"+FOR SELECT USING (+ "companyId" = ANY (+ (+ SELECT+ get_companies_with_employee_role()+ )::text[]+ )+);++CREATE POLICY "INSERT" ON "public"."jobOperationParameter"+FOR INSERT WITH CHECK (+ "companyId" = ANY (+ (+ SELECT+ get_companies_with_employee_permission ('production_create')+ )::text[]+ )+);++CREATE POLICY "UPDATE" ON "public"."jobOperationParameter"+FOR UPDATE USING (+ "companyId" = ANY (+ (+ SELECT+ get_companies_with_employee_permission ('production_update')+ )::text[]+ )+);++CREATE POLICY "DELETE" ON "public"."jobOperationParameter"+FOR DELETE USING (+ "companyId" = ANY (+ (+ SELECT+ get_companies_with_employee_permission ('production_delete')+ )::text[]+ )+);\ No newline at end of filediff --git a/packages/form/src/components/Input.tsx b/packages/form/src/components/Input.tsxindex c50ae1043e..c0e13c3773 100644--- a/packages/form/src/components/Input.tsx+++ b/packages/form/src/components/Input.tsx@@ -12,27 +12,45 @@ import {import type { ReactNode } from "react";import { forwardRef } from "react";import { useField } from "../hooks";+import { ValidationBehaviorOptions } from "src/internal/getInputProps";type FormInputProps = InputProps & {name: string;label?: ReactNode;- isOptional?: boolean;+ isConfigured?: boolean;+ isRequired?: boolean;helperText?: string;prefix?: string;suffix?: string;+ validationBehavior?: ValidationBehaviorOptions;+ onConfigure?: () => void;};const Input = forwardRef<HTMLInputElement, FormInputProps>((- { name, label, isOptional = false, helperText, prefix, suffix, ...rest },+ {+ name,+ label,+ isConfigured,+ isRequired,+ helperText,+ prefix,+ suffix,+ onConfigure,+ ...rest+ },ref) => {const { getInputProps, error } = useField(name);return (- <FormControl isInvalid={!!error}>+ <FormControl isInvalid={!!error} isRequired={isRequired}>{label && (- <FormLabel htmlFor={name} isOptional={isOptional}>+ <FormLabel+ htmlFor={name}+ isConfigured={isConfigured}+ onConfigure={onConfigure}+ >{label}</FormLabel>)}