Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

feat: add and delete gauges

Brad Barbinb7903a7c428b
diff --git a/apps/erp/app/modules/quality/quality.models.ts b/apps/erp/app/modules/quality/quality.models.ts
index b9e9a0a19e..308858cbb5 100644
--- a/apps/erp/app/modules/quality/quality.models.ts
+++ b/apps/erp/app/modules/quality/quality.models.ts
@@ -1,6 +1,14 @@
import { z } from "zod";
import { zfd } from "zod-form-data";
+export const gaugeStatus = ["Active", "Inactive"] as const;
+export const gaugeCalibrationStatus = [
+ "Pending",
+ "In-Calibration",
+ "Out-of-Calibration",
+] as const;
+export const gaugeRole = ["Master", "Standard"] as const;
+
export const nonConformanceInvestigationType = [
"Root Cause Analysis",
"Inventory",
@@ -54,6 +62,24 @@ export const nonConformanceAssociationType = [
"trackedEntities",
] as const;
+export const gaugeValidator = z.object({
+ id: zfd.text(z.string().optional()),
+ gaugeId: zfd.text(z.string().optional()),
+ supplierId: zfd.text(z.string().optional()),
+ modelNumber: zfd.text(z.string().optional()),
+ serialNumber: zfd.text(z.string().optional()),
+ description: zfd.text(z.string().optional()),
+ dateAcquired: zfd.text(z.string().optional()),
+ gaugeTypeId: z.string().min(1, { message: "Type is required" }),
+ // gaugeCalibrationStatus: z.enum(gaugeCalibrationStatus),
+ // gaugeStatus: z.enum(gaugeStatus),
+ gaugeRole: z.enum(gaugeRole),
+ lastCalibrationDate: zfd.text(z.string().optional()),
+ nextCalibrationDate: zfd.text(z.string().optional()),
+ locationId: zfd.text(z.string().optional()),
+ shelfId: zfd.text(z.string().optional()),
+});
+
export const gaugeTypeValidator = z.object({
id: zfd.text(z.string().optional()),
name: z.string().min(1, { message: "Name is required" }),
diff --git a/apps/erp/app/modules/quality/quality.service.ts b/apps/erp/app/modules/quality/quality.service.ts
index 152ebba98f..edef324f78 100644
--- a/apps/erp/app/modules/quality/quality.service.ts
+++ b/apps/erp/app/modules/quality/quality.service.ts
@@ -6,6 +6,7 @@ import { setGenericQueryFilters } from "~/utils/query";
import { sanitize } from "~/utils/supabase";
import type {
gaugeTypeValidator,
+ gaugeValidator,
nonConformanceReviewerValidator,
nonConformanceStatus,
nonConformanceTypeValidator,
@@ -13,6 +14,13 @@ import type {
nonConformanceWorkflowValidator,
} from "./quality.models";
+export async function deleteGauge(
+ client: SupabaseClient<Database>,
+ gaugeId: string
+) {
+ return client.from("gauges").delete().eq("id", gaugeId);
+}
+
export async function deleteGaugeType(
client: SupabaseClient<Database>,
gaugeTypeId: string
@@ -98,6 +106,38 @@ export async function deleteNonConformanceWorkflow(
.eq("id", nonConformanceWorkflowId);
}
+export async function getGauge(
+ client: SupabaseClient<Database>,
+ gaugeId: string
+) {
+ return client.from("gauges").select("*").eq("id", gaugeId).single();
+}
+
+export async function getGauges(
+ client: SupabaseClient<Database>,
+ companyId: string,
+ args?: GenericQueryFilters & { search: string | null }
+) {
+ let query = client
+ .from("gauges")
+ .select("*", { count: "exact" })
+ .eq("companyId", companyId);
+
+ if (args?.search) {
+ query = query.or(
+ `gaugeId.ilike.%${args.search}%,description.ilike.%${args.search},modelNumber.ilike.%${args.search},serialNumber.ilike.%${args.search}`
+ );
+ }
+
+ if (args) {
+ query = setGenericQueryFilters(query, args, [
+ { column: "gaugeId", ascending: false },
+ ]);
+ }
+
+ return query;
+}
+
export async function getGaugeTypesList(
client: SupabaseClient<Database>,
companyId: string
@@ -594,6 +634,29 @@ export async function updateNonConformanceTaskStatus(
.eq("id", id);
}
+export async function upsertGauge(
+ client: SupabaseClient<Database>,
+ gauge:
+ | (Omit<z.infer<typeof gaugeValidator>, "id" | "gaugeId"> & {
+ gaugeId: string;
+ companyId: string;
+ createdBy: string;
+ customFields?: Json;
+ })
+ | (Omit<z.infer<typeof gaugeValidator>, "id" | "gaugeId"> & {
+ id: string;
+ gaugeId: string;
+ updatedBy: string;
+ customFields?: Json;
+ })
+) {
+ if ("createdBy" in gauge) {
+ return client.from("gauges").insert([gauge]).select("id").single();
+ } else {
+ return client.from("gauges").update(sanitize(gauge)).eq("id", gauge.id);
+ }
+}
+
export async function upsertGaugeType(
client: SupabaseClient<Database>,
gaugeType:
diff --git a/apps/erp/app/modules/quality/types.ts b/apps/erp/app/modules/quality/types.ts
index 7ea7bc290d..3511fd67be 100644
--- a/apps/erp/app/modules/quality/types.ts
+++ b/apps/erp/app/modules/quality/types.ts
@@ -1,6 +1,7 @@
import type { Database } from "@carbon/database";
import type { nonConformanceAssociationType } from "./quality.models";
import type {
+ getGauges,
getGaugeTypes,
getNonConformance,
getNonConformanceActionTasks,
@@ -11,6 +12,10 @@ import type {
getNonConformanceWorkflow,
} from "./quality.service";
+export type Gauge = NonNullable<
+ Awaited<ReturnType<typeof getGauges>>["data"]
+>[number];
+
export type GaugeType = NonNullable<
Awaited<ReturnType<typeof getGaugeTypes>>["data"]
>[number];
diff --git a/apps/erp/app/modules/quality/ui/Gauge/GaugeForm.tsx b/apps/erp/app/modules/quality/ui/Gauge/GaugeForm.tsx
new file mode 100644
index 0000000000..2cda00cffb
--- /dev/null
+++ b/apps/erp/app/modules/quality/ui/Gauge/GaugeForm.tsx
@@ -0,0 +1,141 @@
+import { DatePicker, Select, ValidatedForm } from "@carbon/form";
+import {
+ Card,
+ CardContent,
+ CardDescription,
+ CardFooter,
+ CardHeader,
+ CardTitle,
+ VStack,
+} from "@carbon/react";
+import type { z } from "zod";
+import { Enumerable } from "~/components/Enumerable";
+import {
+ CustomFormFields,
+ Hidden,
+ Input,
+ Location,
+ SequenceOrCustomId,
+ Shelf,
+ Submit,
+ Supplier,
+} from "~/components/Form";
+import { usePermissions } from "~/hooks";
+import type { ListItem } from "~/types";
+import { gaugeRole, gaugeValidator } from "../../quality.models";
+import { GaugeRole } from "./GaugeStatus";
+
+type GaugeFormValues = z.infer<typeof gaugeValidator>;
+
+type GaugeFormProps = {
+ initialValues: GaugeFormValues;
+ gaugeTypes: ListItem[];
+};
+
+const GaugeForm = ({ initialValues, gaugeTypes }: GaugeFormProps) => {
+ const permissions = usePermissions();
+ const isEditing = initialValues.id !== undefined;
+
+ return (
+ <Card>
+ <ValidatedForm
+ method="post"
+ validator={gaugeValidator}
+ defaultValues={initialValues}
+ className="w-full"
+ >
+ <CardHeader>
+ <CardTitle>{isEditing ? "Gauge" : "New Gauge"}</CardTitle>
+ {!isEditing && (
+ <CardDescription>
+ A gauge record tracks measurement tools and their calibration
+ status.
+ </CardDescription>
+ )}
+ </CardHeader>
+ <CardContent>
+ <Hidden name="id" />
+
+ <VStack spacing={4}>
+ <div className="grid w-full gap-4 grid-cols-1 md:grid-cols-2">
+ {isEditing ? (
+ <Input name="gaugeId" label="Gauge ID" isReadOnly />
+ ) : (
+ <SequenceOrCustomId
+ name="gaugeId"
+ label="Gauge ID"
+ table="gauge"
+ />
+ )}
+ <Input name="description" label="Description" />
+ <Select
+ name="gaugeTypeId"
+ label="Gauge Type"
+ options={gaugeTypes.map((type) => ({
+ label: <Enumerable value={type.name} />,
+ value: type.id,
+ }))}
+ />
+ <Supplier name="supplierId" label="Supplier" />
+ <Input name="modelNumber" label="Model Number" />
+ <Input name="serialNumber" label="Serial Number" />
+ {/* <Select
+ name="gaugeCalibrationStatus"
+ label="Calibration Status"
+ options={gaugeCalibrationStatus.map((status) => ({
+ label: <GaugeCalibrationStatus status={status} />,
+ value: status,
+ }))}
+ /> */}
+ <Select
+ name="gaugeRole"
+ label="Role"
+ options={gaugeRole.map((role) => ({
+ label: <GaugeRole role={role} />,
+ value: role,
+ }))}
+ />
+ <DatePicker name="dateAcquired" label="Date Acquired" />
+ {/* <Select
+ name="gaugeStatus"
+ label="Status"
+ options={gaugeStatus.map((status) => ({
+ label: <GaugeStatus status={status} />,
+ value: status,
+ }))}
+ /> */}
+ <DatePicker
+ name="lastCalibrationDate"
+ label="Last Calibration Date"
+ />
+ <DatePicker
+ name="nextCalibrationDate"
+ label="Next Calibration Date"
+ />
+ <Location name="locationId" label="Location" />
+ <Shelf
+ name="shelfId"
+ label="Shelf"
+ locationId={initialValues.locationId}
+ />
+ <CustomFormFields table="gauge" />
+ </div>
+ </VStack>
+ </CardContent>
+ <CardFooter>
+ <Submit
+ isDisabled={
+ isEditing
+ ? !permissions.can("update", "quality")
+ : !permissions.can("create", "quality")
+ }
+ >
+ Save
+ </Submit>
+ </CardFooter>
+ </ValidatedForm>
+ </Card>
+ );
+};
+
+export default GaugeForm;
diff --git a/apps/erp/app/modules/quality/ui/Gauge/GaugeStatus.tsx b/apps/erp/app/modules/quality/ui/Gauge/GaugeStatus.tsx
new file mode 100644
index 0000000000..1f5296542f
--- /dev/null
+++ b/apps/erp/app/modules/quality/ui/Gauge/GaugeStatus.tsx
@@ -0,0 +1,51 @@
+import type { Database } from "@carbon/database";
+import { Status } from "@carbon/react";
+
+type GaugeStatusProps = {
+ status?: Database["public"]["Enums"]["gaugeStatus"] | null;
+};
+
+const GaugeStatus = ({ status }: GaugeStatusProps) => {
+ switch (status) {
+ case "Active":
+ return <Status color="gray">{status}</Status>;
+ case "Inactive":
+ return <Status color="red">{status}</Status>;
+ default:
+ return null;
+ }
+};
+
+type GaugeCalibrationStatusProps = {
+ status?: Database["public"]["Enums"]["gaugeCalibrationStatus"] | null;
+};
+
+const GaugeCalibrationStatus = ({ status }: GaugeCalibrationStatusProps) => {
+ switch (status) {
+ case "Pending":
+ return <Status color="orange">{status}</Status>;
+ case "In-Calibration":
+ return <Status color="green">{status}</Status>;
+ case "Out-of-Calibration":
+ return <Status color="red">{status}</Status>;
+ default:
+ return null;
+ }
+};
+
+type GaugeRoleProps = {
+ role?: Database["public"]["Enums"]["gaugeRole"] | null;
+};
+
+const GaugeRole = ({ role }: GaugeRoleProps) => {
+ switch (role) {
+ case "Master":
+ return <Status color="blue">{role}</Status>;
+ case "Standard":
+ return <Status color="gray">{role}</Status>;
+ default:
+ return null;
+ }
+};
+
+export { GaugeCalibrationStatus, GaugeRole, GaugeStatus };
diff --git a/apps/erp/app/modules/quality/ui/Gauge/GaugesTable.tsx b/apps/erp/app/modules/quality/ui/Gauge/GaugesTable.tsx
new file mode 100644
index 0000000000..7958016a13
--- /dev/null
+++ b/apps/erp/app/modules/quality/ui/Gauge/GaugesTable.tsx
@@ -0,0 +1,268 @@
+import { MenuIcon, MenuItem, useDisclosure } from "@carbon/react";
+import { useNavigate } from "@remix-run/react";
+import type { ColumnDef } from "@tanstack/react-table";
+import { memo, useCallback, useMemo, useState } from "react";
+import {
+ LuBookMarked,
+ LuCalendar,
+ LuCircleGauge,
+ LuContainer,
+ LuHash,
+ LuMap,
+ LuPencil,
+ LuShapes,
+ LuTrash,
+} from "react-icons/lu";
+import { Hyperlink, New, SupplierAvatar, Table } from "~/components";
+
+import { flushSync } from "react-dom";
+import { ConfirmDelete } from "~/components/Modals";
+import { usePermissions } from "~/hooks";
+import type { ListItem } from "~/types";
+import { path } from "~/utils/path";
+import type { Gauge } from "../../types";
+
+import { formatDate } from "@carbon/utils";
+import { Enumerable } from "~/components/Enumerable";
+import { useLocations } from "~/components/Form/Location";
+import { useCustomColumns } from "~/hooks/useCustomColumns";
+import { useSuppliers } from "~/stores/suppliers";
+import { gaugeRole, gaugeStatus } from "../../quality.models";
+import { GaugeStatus } from "./GaugeStatus";
+
+type GaugesTableProps = {
+ data: Gauge[];
+ types: ListItem[];
+ count: number;
+};
+
+const GaugesTable = memo(({ data, types, count }: GaugesTableProps) => {
+ const navigate = useNavigate();
+ const permissions = usePermissions();
+ const deleteDisclosure = useDisclosure();
+ const [selectedGauge, setSelectedGauge] = useState<Gauge | null>(null);
+
+ const customColumns = useCustomColumns<Gauge>("gauge");
+ const [suppliers] = useSuppliers();
+ const locations = useLocations();
+
+ const columns = useMemo<ColumnDef<Gauge>[]>(() => {
+ const defaultColumns: ColumnDef<Gauge>[] = [
+ {
+ accessorKey: "gaugeId",
+ header: "Name",
+ cell: ({ row }) => (
+ <Hyperlink to={path.to.gauge(row.original.id!)}>
+ <div className="flex flex-col gap-0">
+ <span className="text-sm font-medium">
+ {row.original.gaugeId}
+ </span>
+ <span className="text-xs text-muted-foreground">
+ {row.original.description}
+ </span>
+ </div>
+ </Hyperlink>
+ ),
+ meta: {
+ icon: <LuBookMarked />,
+ },
+ },
+ {
+ id: "supplierId",
+ header: "Supplier",
+ cell: ({ row }) => {
+ return <SupplierAvatar supplierId={row.original.supplierId} />;
+ },
+ meta: {
+ filter: {
+ type: "static",
+ options: suppliers?.map((supplier) => ({
+ value: supplier.id,
+ label: supplier.name,
+ })),
+ },
+ icon: <LuContainer />,
+ },
+ },
+ {
+ accessorKey: "modelNumber",
+ header: "Model Number",
+ cell: ({ row }) => row.original.modelNumber,
+ meta: {
+ icon: <LuHash />,
+ },
+ },
+ {
+ accessorKey: "serialNumber",
+ header: "Serial Number",
+ cell: ({ row }) => row.original.serialNumber,
+ meta: {
+ icon: <LuHash />,
+ },
+ },
+ {
+ accessorKey: "gaugeTypeId",
+ header: "Type",
+ cell: ({ row }) => (
+ <Enumerable
+ value={
+ types.find((type) => type.id === row.original.gaugeTypeId)
+ ?.name ?? null
+ }
+ />
+ ),
+ meta: {
+ icon: <LuShapes />,
+ filter: {
+ type: "static",
+ options: types.map((type) => ({
+ label: <Enumerable value={type.name} />,
+ value: type.id,
+ })),
+ },
+ },
+ },
+ {
+ accessorKey: "gaugeRole",
+ header: "Role",
+ cell: ({ row }) => row.original.gaugeRole,
+ meta: {
+ icon: <LuHash />,
+ filter: {
+ type: "static",
+ options: gaugeRole.map((role) => ({
+ label: role,
+ value: role,
+ })),
+ },
+ },
+ },
+ {
+ accessorKey: "gaugeStatus",
+ header: "Status",
+ cell: ({ row }) => <GaugeStatus status={row.original.gaugeStatus} />,
+ meta: {
+ icon: <LuCircleGauge />,
+ filter: {
+ type: "static",
+ options: gaugeStatus.map((status) => ({
+ label: status,
+ value: status,
+ })),
+ },
+ },
+ },
+
+ {
+ accessorKey: "nextCalibrationDate",
+ header: "Next Calibration",
+ cell: ({ row }) => formatDate(row.original.nextCalibrationDate),
+ meta: {
+ icon: <LuCalendar />,
+ },
+ },
+ {
+ accessorKey: "lastCalibrationDate",
+ header: "Last Calibration",
+ cell: ({ row }) => formatDate(row.original.lastCalibrationDate),
+ meta: {
+ icon: <LuCalendar />,
+ },
+ },
+ {
+ accessorKey: "locationId",
+ header: "Location",
+ cell: ({ row }) => (
+ <Enumerable
+ value={
+ locations.find(
+ (location) => location.value === row.original.locationId
+ )?.label ?? null
+ }
+ />
+ ),
+ meta: {
+ icon: <LuMap />,
+ filter: {
+ type: "static",
+ options: locations.map((location) => ({
+ label: location.label,
+ value: location.value,
+ })),
+ },
+ },
+ },
+ ];
+ return [...defaultColumns, ...customColumns];
+ }, [customColumns, locations, suppliers, types]);
+
+ const renderContextMenu = useCallback(
+ (row: Gauge) => {
+ return (
+ <>
+ <MenuItem
+ disabled={!permissions.can("update", "quality")}
+ onClick={() => {
+ navigate(`${path.to.gauge(row.id!)}`);
+ }}
+ >
+ <MenuIcon icon={<LuPencil />} />
+ Edit Gauge
+ </MenuItem>
+ <MenuItem
+ destructive
+ disabled={!permissions.can("delete", "quality")}
+ onClick={() => {
+ flushSync(() => {
+ setSelectedGauge(row);
+ });
+ deleteDisclosure.onOpen();
+ }}
+ >
+ <MenuIcon icon={<LuTrash />} />
+ Delete Gauge
+ </MenuItem>
+ </>
+ );
+ },
+ [navigate, permissions, deleteDisclosure]
+ );
+
+ return (
+ <>
+ <Table<Gauge>
+ data={data}
+ columns={columns}
+ count={count}
+ primaryAction={
+ permissions.can("create", "quality") && (
+ <New label="Gauge" to={path.to.newGauge} />
+ )
+ }
+ renderContextMenu={renderContextMenu}
+ title="Gauges"
+ table="gauge"
+ withSavedView
+ />
+ {deleteDisclosure.isOpen && selectedGauge && (
+ <ConfirmDelete
+ action={path.to.deleteGauge(selectedGauge.id!)}
+ isOpen
+ onCancel={() => {
+ setSelectedGauge(null);
+ deleteDisclosure.onClose();
+ }}
+ onSubmit={() => {
+ setSelectedGauge(null);
+ deleteDisclosure.onClose();
+ }}
+ name={selectedGauge.gaugeId ?? "gauge"}
+ text="Are you sure you want to delete this gauge?"
+ />
+ )}
+ </>
+ );
+});
+
+GaugesTable.displayName = "GaugesTable";
+export default GaugesTable;
diff --git a/apps/erp/app/routes/x+/gauge+/delete.$id.tsx b/apps/erp/app/routes/x+/gauge+/delete.$id.tsx
new file mode 100644
index 0000000000..2173131bea
--- /dev/null
+++ b/apps/erp/app/routes/x+/gauge+/delete.$id.tsx
@@ -0,0 +1,32 @@
+import { error, success } from "@carbon/auth";
+import { requirePermissions } from "@carbon/auth/auth.server";
+import { flash } from "@carbon/auth/session.server";
+import type { ActionFunctionArgs } from "@vercel/remix";
+import { json, redirect } from "@vercel/remix";
+import { deleteGauge } from "~/modules/quality";
+import { path } from "~/utils/path";
+
+export async function action({ request, params }: ActionFunctionArgs) {
+ const { client } = await requirePermissions(request, {
+ delete: "quality",
+ });
+
+ const { id } = params;
+
+ if (!id) throw new Error("id is not found");
+
+ const mutation = await deleteGauge(client, id);
+ if (mutation.error) {
+ return json(
+ {
+ success: false,
+ },
+ await flash(request, error(mutation.error, "Failed to delete gauge"))
+ );
+ }
+
+ throw redirect(
+ path.to.gauges,
+ await flash(request, success("Successfully deleted gauge"))
+ );
+}
diff --git a/apps/erp/app/routes/x+/gauge+/new.tsx b/apps/erp/app/routes/x+/gauge+/new.tsx
new file mode 100644
index 0000000000..3e9083da51
--- /dev/null
+++ b/apps/erp/app/routes/x+/gauge+/new.tsx
@@ -0,0 +1,129 @@
+import { assertIsPost, error, getCarbonServiceRole } from "@carbon/auth";
+import { requirePermissions } from "@carbon/auth/auth.server";
+import { flash } from "@carbon/auth/session.server";
+import { validationError, validator } from "@carbon/form";
+import { getLocalTimeZone, today } from "@internationalized/date";
+import { useLoaderData } from "@remix-run/react";
+import type { ActionFunctionArgs, LoaderFunctionArgs } from "@vercel/remix";
+import { json, redirect } from "@vercel/remix";
+import { useUser } from "~/hooks";
+import {
+ gaugeValidator,
+ getGaugeTypesList,
+ upsertGauge,
+} from "~/modules/quality";
+import GaugeForm from "~/modules/quality/ui/Gauge/GaugeForm";
+
+import { getNextSequence } from "~/modules/settings";
+import { setCustomFields } from "~/utils/form";
+import type { Handle } from "~/utils/handle";
+import { path } from "~/utils/path";
+
+export const handle: Handle = {
+ breadcrumb: "Gauges",
+ to: path.to.gauges,
+};
+
+export async function loader({ request }: LoaderFunctionArgs) {
+ const { client, companyId } = await requirePermissions(request, {
+ view: "quality",
+ });
+
+ const [types] = await Promise.all([getGaugeTypesList(client, companyId)]);
+
+ return json({
+ types: types.data ?? [],
+ });
+}
+
+export async function action({ request }: ActionFunctionArgs) {
+ assertIsPost(request);
+ const { client, companyId, userId } = await requirePermissions(request, {
+ create: "quality",
+ });
+
+ const formData = await request.formData();
+ const validation = await validator(gaugeValidator).validate(formData);
+
+ if (validation.error) {
+ return validationError(validation.error);
+ }
+
+ let gaugeId = validation.data.gaugeId;
+ const useNextSequence = !gaugeId;
+ if (useNextSequence) {
+ const nextSequence = await getNextSequence(
+ getCarbonServiceRole(),
+ "gauge",
+ companyId
+ );
+ if (nextSequence.error) {
+ throw redirect(
+ path.to.newGauge,
+ await flash(
+ request,
+ error(nextSequence.error, "Failed to get next sequence")
+ )
+ );
+ }
+ gaugeId = nextSequence.data;
+ }
+
+ if (!gaugeId) throw new Error("gaugeId is not defined");
+ const { id: _id, ...data } = validation.data;
+
+ const createGauge = await upsertGauge(client, {
+ ...data,
+ gaugeId,
+ companyId,
+ createdBy: userId,
+ customFields: setCustomFields(formData),
+ });
+
+ if (createGauge.error || !createGauge.data) {
+ throw redirect(
+ path.to.gauges,
+ await flash(request, error(createGauge.error, "Failed to insert gauge"))
+ );
+ }
+
+ const id = createGauge.data?.id;
+ if (!id) {
+ throw redirect(
+ path.to.gauges,
+ await flash(request, error("Failed to insert gauge"))
+ );
+ }
+
+ throw redirect(path.to.gauge(id!));
+}
+
+export default function GaugeNewRoute() {
+ const { types } = useLoaderData<typeof loader>();
+
+ const { defaults } = useUser();
+
+ const initialValues = {
+ id: undefined,
+ gaugeId: undefined,
+ supplierId: "",
+ modelNumber: "",
+ serialNumber: "",
+ description: "",
+ dateAcquired: today(getLocalTimeZone()).toString(),
+ gaugeTypeId: "",
+ gaugeCalibrationStatus: "Pending" as const,
+ gaugeStatus: "Active" as const,
+ gaugeRole: "Standard" as const,
+ lastCalibrationDate: "",
+ nextCalibrationDate: "",
+ locationId: defaults.locationId ?? "",
+ shelfId: "",
+ };
+
+ return (
+ <div className="max-w-4xl w-full p-2 sm:p-0 mx-auto mt-0 md:mt-8">
+ <GaugeForm initialValues={initialValues} gaugeTypes={types} />
+ </div>
+ );
+}
diff --git a/apps/erp/app/routes/x+/non-conformance+/delete.$id.tsx b/apps/erp/app/routes/x+/non-conformance+/delete.$id.tsx
index 8d10a580fe..c8bf345bc4 100644
--- a/apps/erp/app/routes/x+/non-conformance+/delete.$id.tsx
+++ b/apps/erp/app/routes/x+/non-conformance+/delete.$id.tsx
@@ -23,16 +23,13 @@ export async function action({ request, params }: ActionFunctionArgs) {
},
await flash(
request,
- error(mutation.error, "Failed to delete non-conformance workflow")
+ error(mutation.error, "Failed to delete non-conformance")
)
);
}
throw redirect(
path.to.nonConformances,
- await flash(
- request,
- success("Successfully deleted non-conformance workflow")
- )
+ await flash(request, success("Successfully deleted non-conformance"))
);
}
diff --git a/apps/erp/app/routes/x+/quality+/gauges.tsx b/apps/erp/app/routes/x+/quality+/gauges.tsx
new file mode 100644
index 0000000000..98aef20a17
--- /dev/null
+++ b/apps/erp/app/routes/x+/quality+/gauges.tsx
@@ -0,0 +1,56 @@
+import { requirePermissions } from "@carbon/auth/auth.server";
+import { VStack } from "@carbon/react";
+import { Outlet, useLoaderData } from "@remix-run/react";
+import type { LoaderFunctionArgs } from "@vercel/remix";
+import { json } from "@vercel/remix";
+import { getGauges, getGaugeTypesList } from "~/modules/quality";
+import GaugesTable from "~/modules/quality/ui/Gauge/GaugesTable";
+import type { Handle } from "~/utils/handle";
+import { path } from "~/utils/path";
+import { getGenericQueryFilters } from "~/utils/query";
+
+export const handle: Handle = {
+ breadcrumb: "Gauges",
+ to: path.to.gauges,
+};
+
+export async function loader({ request }: LoaderFunctionArgs) {
+ const { client, companyId } = await requirePermissions(request, {
+ view: "quality",
+ role: "employee",
+ });
+
+ const url = new URL(request.url);
+ const searchParams = new URLSearchParams(url.search);
+ const search = searchParams.get("search");
+ const { limit, offset, sorts, filters } =
+ getGenericQueryFilters(searchParams);
+
+ const [gauges, gaugeTypes] = await Promise.all([
+ getGauges(client, companyId, {
+ search,
+ limit,
+ offset,
+ sorts,
+ filters,
+ }),
+ getGaugeTypesList(client, companyId),
+ ]);
+
+ return json({
+ gauges: gauges.data ?? [],
+ count: gauges.count ?? 0,
+ types: gaugeTypes.data ?? [],
+ });
+}
+
+export default function GaugesRoute() {
+ const { gauges, count, types } = useLoaderData<typeof loader>();
+
+ return (
+ <VStack spacing={0} className="h-full">
+ <GaugesTable data={gauges} count={count} types={types} />
+ <Outlet />
+ </VStack>
+ );
+}
diff --git a/apps/erp/app/utils/path.ts b/apps/erp/app/utils/path.ts
index 1f21c2d259..5b7e0e9ff2 100644
--- a/apps/erp/app/utils/path.ts
+++ b/apps/erp/app/utils/path.ts
@@ -420,6 +420,7 @@ export const path = {
generatePath(`${x}/resources/ability/${abilityId}/employee/delete/${id}`),
deleteEmployeeType: (id: string) =>
generatePath(`${x}/users/employee-types/delete/${id}`),
+ deleteGauge: (id: string) => generatePath(`${x}/gauge/delete/${id}`),
deleteGaugeType: (id: string) =>
generatePath(`${x}/quality/gauge-types/delete/${id}`),
deleteGroup: (id: string) => generatePath(`${x}/users/groups/delete/${id}`),
@@ -566,6 +567,7 @@ export const path = {
feedback: `${x}/feedback`,
fiscalYears: `${x}/accounting/years`,
forgotPassword: "/forgot-password",
+ gauge: (id: string) => generatePath(`${x}/gauge/${id}`),
gauges: `${x}/quality/gauges`,
gaugeTypes: `${x}/quality/gauge-types`,
gaugeType: (id: string) => generatePath(`${x}/quality/gauge-types/${id}`),
@@ -725,6 +727,7 @@ export const path = {
newFixture: `${x}/fixture/new`,
newFixtureSupplier: (id: string) =>
generatePath(`${x}/fixture/${id}/purchasing/new`),
+ newGauge: `${x}/gauge/new`,
newGaugeType: `${x}/quality/gauge-types/new`,
newGroup: `${x}/users/groups/new`,
newHoliday: `${x}/people/holidays/new`,
diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.ts
index 3228441953..117e0891fd 100644
--- a/packages/database/src/swagger-docs-schema.ts
+++ b/packages/database/src/swagger-docs-schema.ts
@@ -7449,6 +7449,294 @@ export default {
tags: ["jobMaterialWithMakeMethodId"],
},
},
+ "/gauges": {
+ get: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.gauges.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.gaugeId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.supplierId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.modelNumber",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.serialNumber",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.description",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.dateAcquired",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.gaugeTypeId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.gaugeCalibrationStatus",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.gaugeStatus",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.gaugeRole",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.lastCalibrationDate",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.nextCalibrationDate",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.locationId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.shelfId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.companyId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.customFields",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.createdAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.createdBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.updatedBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.gaugeCalibrationStatusWithDueDate",
+ },
+ {
+ $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/gauges",
+ },
+ type: "array",
+ },
+ },
+ "206": {
+ description: "Partial Content",
+ },
+ },
+ tags: ["gauges"],
+ },
+ post: {
+ parameters: [
+ {
+ $ref: "#/parameters/body.gauges",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/preferPost",
+ },
+ ],
+ responses: {
+ "201": {
+ description: "Created",
+ },
+ },
+ tags: ["gauges"],
+ },
+ delete: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.gauges.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.gaugeId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.supplierId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.modelNumber",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.serialNumber",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.description",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.dateAcquired",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.gaugeTypeId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.gaugeCalibrationStatus",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.gaugeStatus",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.gaugeRole",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.lastCalibrationDate",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.nextCalibrationDate",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.locationId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.shelfId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.companyId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.customFields",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.createdAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.createdBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.updatedBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.gaugeCalibrationStatusWithDueDate",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["gauges"],
+ },
+ patch: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.gauges.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.gaugeId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.supplierId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.modelNumber",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.serialNumber",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.description",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.dateAcquired",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.gaugeTypeId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.gaugeCalibrationStatus",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.gaugeStatus",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.gaugeRole",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.lastCalibrationDate",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.nextCalibrationDate",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.locationId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.shelfId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.companyId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.customFields",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.createdAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.createdBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.updatedBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauges.gaugeCalibrationStatusWithDueDate",
+ },
+ {
+ $ref: "#/parameters/body.gauges",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["gauges"],
+ },
+ },
"/currencyCode": {
get: {
parameters: [
@@ -45693,6 +45981,285 @@ export default {
tags: ["workCenter"],
},
},
+ "/gauge": {
+ get: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.gauge.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.gaugeId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.supplierId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.modelNumber",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.serialNumber",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.description",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.dateAcquired",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.gaugeTypeId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.gaugeCalibrationStatus",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.gaugeStatus",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.gaugeRole",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.lastCalibrationDate",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.nextCalibrationDate",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.locationId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.shelfId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.companyId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.customFields",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.createdAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.createdBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.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/gauge",
+ },
+ type: "array",
+ },
+ },
+ "206": {
+ description: "Partial Content",
+ },
+ },
+ tags: ["gauge"],
+ },
+ post: {
+ parameters: [
+ {
+ $ref: "#/parameters/body.gauge",
+ },
+ {
+ $ref: "#/parameters/select",
+ },
+ {
+ $ref: "#/parameters/preferPost",
+ },
+ ],
+ responses: {
+ "201": {
+ description: "Created",
+ },
+ },
+ tags: ["gauge"],
+ },
+ delete: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.gauge.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.gaugeId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.supplierId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.modelNumber",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.serialNumber",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.description",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.dateAcquired",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.gaugeTypeId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.gaugeCalibrationStatus",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.gaugeStatus",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.gaugeRole",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.lastCalibrationDate",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.nextCalibrationDate",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.locationId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.shelfId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.companyId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.customFields",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.createdAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.createdBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.updatedBy",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["gauge"],
+ },
+ patch: {
+ parameters: [
+ {
+ $ref: "#/parameters/rowFilter.gauge.id",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.gaugeId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.supplierId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.modelNumber",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.serialNumber",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.description",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.dateAcquired",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.gaugeTypeId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.gaugeCalibrationStatus",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.gaugeStatus",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.gaugeRole",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.lastCalibrationDate",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.nextCalibrationDate",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.locationId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.shelfId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.companyId",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.customFields",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.createdAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.createdBy",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.updatedAt",
+ },
+ {
+ $ref: "#/parameters/rowFilter.gauge.updatedBy",
+ },
+ {
+ $ref: "#/parameters/body.gauge",
+ },
+ {
+ $ref: "#/parameters/preferReturn",
+ },
+ ],
+ responses: {
+ "204": {
+ description: "No Content",
+ },
+ },
+ tags: ["gauge"],
+ },
+ },
"/supplierProcess": {
get: {
parameters: [
@@ -55655,7 +56222,7 @@ export default {
properties: {
id: {
description:
- "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `supplierLocation.id`.<fk table='supplierLocation' column='id'/>",
+ "Note:\nThis is a Foreign Key to `supplierLocation.id`.<fk table='supplierLocation' column='id'/>",
format: "text",
type: "string",
},
@@ -55704,7 +56271,7 @@ export default {
},
supplierLocationId: {
description:
- "Note:\nThis is a Foreign Key to `supplierLocation.id`.<fk table='supplierLocation' column='id'/>",
+ "Note:\nThis is a Primary Key.<pk/>\nThis is a Foreign Key to `supplierLocation.id`.<fk table='supplierLocation' column='id'/>",
format: "text",
type: "string",
},
@@ -55871,6 +56438,117 @@ export default {
},
type: "object",
},
+ gauges: {
+ properties: {
+ id: {
+ description: "Note:\nThis is a Primary Key.<pk/>",
+ format: "text",
+ type: "string",
+ },
+ gaugeId: {
+ format: "text",
+ type: "string",
+ },
+ supplierId: {
+ description:
+ "Note:\nThis is a Foreign Key to `supplier.id`.<fk table='supplier' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ modelNumber: {
+ format: "text",
+ type: "string",
+ },
+ serialNumber: {
+ format: "text",
+ type: "string",
+ },
+ description: {
+ format: "text",
+ type: "string",
+ },
+ dateAcquired: {
+ format: "date",
+ type: "string",
+ },
+ gaugeTypeId: {
+ description:
+ "Note:\nThis is a Foreign Key to `gaugeType.id`.<fk table='gaugeType' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ gaugeCalibrationStatus: {
+ enum: ["Pending", "In-Calibration", "Out-of-Calibration"],
+ format: 'public."gaugeCalibrationStatus"',
+ type: "string",
+ },
+ gaugeStatus: {
+ enum: ["Active", "Inactive"],
+ format: 'public."gaugeStatus"',
+ type: "string",
+ },
+ gaugeRole: {
+ enum: ["Master", "Standard"],
+ format: 'public."gaugeRole"',
+ type: "string",
+ },
+ lastCalibrationDate: {
+ format: "date",
+ type: "string",
+ },
+ nextCalibrationDate: {
+ format: "date",
+ type: "string",
+ },
+ locationId: {
+ description:
+ "Note:\nThis is a Foreign Key to `location.id`.<fk table='location' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ shelfId: {
+ description:
+ "Note:\nThis is a Foreign Key to `shelf.id`.<fk table='shelf' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ companyId: {
+ description:
+ "Note:\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ customFields: {
+ format: "json",
+ },
+ createdAt: {
+ format: "timestamp with time zone",
+ type: "string",
+ },
+ createdBy: {
+ description:
+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ updatedAt: {
+ format: "timestamp with time zone",
+ type: "string",
+ },
+ updatedBy: {
+ description:
+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ gaugeCalibrationStatusWithDueDate: {
+ enum: ["Pending", "In-Calibration", "Out-of-Calibration"],
+ format: 'public."gaugeCalibrationStatus"',
+ type: "string",
+ },
+ },
+ type: "object",
+ },
currencyCode: {
required: ["code", "name"],
properties: {
@@ -73844,6 +74522,128 @@ export default {
},
type: "object",
},
+ gauge: {
+ required: [
+ "id",
+ "gaugeId",
+ "gaugeTypeId",
+ "gaugeCalibrationStatus",
+ "gaugeStatus",
+ "gaugeRole",
+ "customFields",
+ "createdAt",
+ "createdBy",
+ ],
+ properties: {
+ id: {
+ default: "public.xid()",
+ description: "Note:\nThis is a Primary Key.<pk/>",
+ format: "text",
+ type: "string",
+ },
+ gaugeId: {
+ format: "text",
+ type: "string",
+ },
+ supplierId: {
+ description:
+ "Note:\nThis is a Foreign Key to `supplier.id`.<fk table='supplier' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ modelNumber: {
+ format: "text",
+ type: "string",
+ },
+ serialNumber: {
+ format: "text",
+ type: "string",
+ },
+ description: {
+ format: "text",
+ type: "string",
+ },
+ dateAcquired: {
+ format: "date",
+ type: "string",
+ },
+ gaugeTypeId: {
+ description:
+ "Note:\nThis is a Foreign Key to `gaugeType.id`.<fk table='gaugeType' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ gaugeCalibrationStatus: {
+ default: "Pending",
+ enum: ["Pending", "In-Calibration", "Out-of-Calibration"],
+ format: 'public."gaugeCalibrationStatus"',
+ type: "string",
+ },
+ gaugeStatus: {
+ default: "Active",
+ enum: ["Active", "Inactive"],
+ format: 'public."gaugeStatus"',
+ type: "string",
+ },
+ gaugeRole: {
+ default: "Standard",
+ enum: ["Master", "Standard"],
+ format: 'public."gaugeRole"',
+ type: "string",
+ },
+ lastCalibrationDate: {
+ format: "date",
+ type: "string",
+ },
+ nextCalibrationDate: {
+ format: "date",
+ type: "string",
+ },
+ locationId: {
+ description:
+ "Note:\nThis is a Foreign Key to `location.id`.<fk table='location' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ shelfId: {
+ description:
+ "Note:\nThis is a Foreign Key to `shelf.id`.<fk table='shelf' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ companyId: {
+ description:
+ "Note:\nThis is a Foreign Key to `company.id`.<fk table='company' column='id'/>",
+ format: "text",
+ type: "string",
+ },
+ customFields: {
+ format: "json",
+ },
+ 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",
+ },
supplierProcess: {
required: [
"id",
@@ -78646,6 +79446,147 @@ export default {
in: "query",
type: "string",
},
+ "body.gauges": {
+ name: "gauges",
+ description: "gauges",
+ required: false,
+ in: "body",
+ schema: {
+ $ref: "#/definitions/gauges",
+ },
+ },
+ "rowFilter.gauges.id": {
+ name: "id",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauges.gaugeId": {
+ name: "gaugeId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauges.supplierId": {
+ name: "supplierId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauges.modelNumber": {
+ name: "modelNumber",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauges.serialNumber": {
+ name: "serialNumber",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauges.description": {
+ name: "description",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauges.dateAcquired": {
+ name: "dateAcquired",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauges.gaugeTypeId": {
+ name: "gaugeTypeId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauges.gaugeCalibrationStatus": {
+ name: "gaugeCalibrationStatus",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauges.gaugeStatus": {
+ name: "gaugeStatus",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauges.gaugeRole": {
+ name: "gaugeRole",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauges.lastCalibrationDate": {
+ name: "lastCalibrationDate",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauges.nextCalibrationDate": {
+ name: "nextCalibrationDate",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauges.locationId": {
+ name: "locationId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauges.shelfId": {
+ name: "shelfId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauges.companyId": {
+ name: "companyId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauges.customFields": {
+ name: "customFields",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauges.createdAt": {
+ name: "createdAt",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauges.createdBy": {
+ name: "createdBy",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauges.updatedAt": {
+ name: "updatedAt",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauges.updatedBy": {
+ name: "updatedBy",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauges.gaugeCalibrationStatusWithDueDate": {
+ name: "gaugeCalibrationStatusWithDueDate",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.currencyCode": {
name: "currencyCode",
description: "currencyCode",
@@ -98902,6 +99843,141 @@ export default {
in: "query",
type: "string",
},
+ "body.gauge": {
+ name: "gauge",
+ description: "gauge",
+ required: false,
+ in: "body",
+ schema: {
+ $ref: "#/definitions/gauge",
+ },
+ },
+ "rowFilter.gauge.id": {
+ name: "id",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauge.gaugeId": {
+ name: "gaugeId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauge.supplierId": {
+ name: "supplierId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauge.modelNumber": {
+ name: "modelNumber",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauge.serialNumber": {
+ name: "serialNumber",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauge.description": {
+ name: "description",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauge.dateAcquired": {
+ name: "dateAcquired",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauge.gaugeTypeId": {
+ name: "gaugeTypeId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauge.gaugeCalibrationStatus": {
+ name: "gaugeCalibrationStatus",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauge.gaugeStatus": {
+ name: "gaugeStatus",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauge.gaugeRole": {
+ name: "gaugeRole",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauge.lastCalibrationDate": {
+ name: "lastCalibrationDate",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauge.nextCalibrationDate": {
+ name: "nextCalibrationDate",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauge.locationId": {
+ name: "locationId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauge.shelfId": {
+ name: "shelfId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauge.companyId": {
+ name: "companyId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauge.customFields": {
+ name: "customFields",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauge.createdAt": {
+ name: "createdAt",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauge.createdBy": {
+ name: "createdBy",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauge.updatedAt": {
+ name: "updatedAt",
+ required: false,
+ in: "query",
+ type: "string",
+ },
+ "rowFilter.gauge.updatedBy": {
+ name: "updatedBy",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.supplierProcess": {
name: "supplierProcess",
description: "supplierProcess",
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index b50ed403cb..5bd3536d2d 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -6173,6 +6173,233 @@ export type Database = {
},
]
}
+ gauge: {
+ Row: {
+ companyId: string | null
+ createdAt: string
+ createdBy: string
+ customFields: Json
+ dateAcquired: string | null
+ description: string | null
+ gaugeCalibrationStatus: Database["public"]["Enums"]["gaugeCalibrationStatus"]
+ gaugeId: string
+ gaugeRole: Database["public"]["Enums"]["gaugeRole"]
+ gaugeStatus: Database["public"]["Enums"]["gaugeStatus"]
+ gaugeTypeId: string
+ id: string
+ lastCalibrationDate: string | null
+ locationId: string | null
+ modelNumber: string | null
+ nextCalibrationDate: string | null
+ serialNumber: string | null
+ shelfId: string | null
+ supplierId: string | null
+ updatedAt: string | null
+ updatedBy: string | null
+ }
+ Insert: {
+ companyId?: string | null
+ createdAt?: string
+ createdBy: string
+ customFields?: Json
+ dateAcquired?: string | null
+ description?: string | null
+ gaugeCalibrationStatus?: Database["public"]["Enums"]["gaugeCalibrationStatus"]
+ gaugeId: string
+ gaugeRole?: Database["public"]["Enums"]["gaugeRole"]
+ gaugeStatus?: Database["public"]["Enums"]["gaugeStatus"]
+ gaugeTypeId: string
+ id?: string
+ lastCalibrationDate?: string | null
+ locationId?: string | null
+ modelNumber?: string | null
+ nextCalibrationDate?: string | null
+ serialNumber?: string | null
+ shelfId?: string | null
+ supplierId?: string | null
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Update: {
+ companyId?: string | null
+ createdAt?: string
+ createdBy?: string
+ customFields?: Json
+ dateAcquired?: string | null
+ description?: string | null
+ gaugeCalibrationStatus?: Database["public"]["Enums"]["gaugeCalibrationStatus"]
+ gaugeId?: string
+ gaugeRole?: Database["public"]["Enums"]["gaugeRole"]
+ gaugeStatus?: Database["public"]["Enums"]["gaugeStatus"]
+ gaugeTypeId?: string
+ id?: string
+ lastCalibrationDate?: string | null
+ locationId?: string | null
+ modelNumber?: string | null
+ nextCalibrationDate?: string | null
+ serialNumber?: string | null
+ shelfId?: string | null
+ supplierId?: string | null
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Relationships: [
+ {
+ foreignKeyName: "gauge_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "companies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "company"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "customFieldTables"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "gauge_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "integrations"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "gauge_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ {
+ foreignKeyName: "gauge_gaugeTypeId_fkey"
+ columns: ["gaugeTypeId"]
+ isOneToOne: false
+ referencedRelation: "gaugeType"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_locationId_fkey"
+ columns: ["locationId"]
+ isOneToOne: false
+ referencedRelation: "location"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_shelfId_fkey"
+ columns: ["shelfId"]
+ isOneToOne: false
+ referencedRelation: "shelf"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_supplierId_fkey"
+ columns: ["supplierId"]
+ isOneToOne: false
+ referencedRelation: "contractors"
+ referencedColumns: ["supplierId"]
+ },
+ {
+ foreignKeyName: "gauge_supplierId_fkey"
+ columns: ["supplierId"]
+ isOneToOne: false
+ referencedRelation: "partners"
+ referencedColumns: ["supplierId"]
+ },
+ {
+ foreignKeyName: "gauge_supplierId_fkey"
+ columns: ["supplierId"]
+ isOneToOne: false
+ referencedRelation: "purchaseOrderSuppliers"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_supplierId_fkey"
+ columns: ["supplierId"]
+ isOneToOne: false
+ referencedRelation: "supplier"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_supplierId_fkey"
+ columns: ["supplierId"]
+ isOneToOne: false
+ referencedRelation: "suppliers"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ ]
+ }
gaugeType: {
Row: {
companyId: string | null
@@ -32533,6 +32760,244 @@ export type Database = {
},
]
}
+ gauges: {
+ Row: {
+ companyId: string | null
+ createdAt: string | null
+ createdBy: string | null
+ customFields: Json | null
+ dateAcquired: string | null
+ description: string | null
+ gaugeCalibrationStatus:
+ | Database["public"]["Enums"]["gaugeCalibrationStatus"]
+ | null
+ gaugeCalibrationStatusWithDueDate:
+ | Database["public"]["Enums"]["gaugeCalibrationStatus"]
+ | null
+ gaugeId: string | null
+ gaugeRole: Database["public"]["Enums"]["gaugeRole"] | null
+ gaugeStatus: Database["public"]["Enums"]["gaugeStatus"] | null
+ gaugeTypeId: string | null
+ id: string | null
+ lastCalibrationDate: string | null
+ locationId: string | null
+ modelNumber: string | null
+ nextCalibrationDate: string | null
+ serialNumber: string | null
+ shelfId: string | null
+ supplierId: string | null
+ updatedAt: string | null
+ updatedBy: string | null
+ }
+ Insert: {
+ companyId?: string | null
+ createdAt?: string | null
+ createdBy?: string | null
+ customFields?: Json | null
+ dateAcquired?: string | null
+ description?: string | null
+ gaugeCalibrationStatus?:
+ | Database["public"]["Enums"]["gaugeCalibrationStatus"]
+ | null
+ gaugeCalibrationStatusWithDueDate?: never
+ gaugeId?: string | null
+ gaugeRole?: Database["public"]["Enums"]["gaugeRole"] | null
+ gaugeStatus?: Database["public"]["Enums"]["gaugeStatus"] | null
+ gaugeTypeId?: string | null
+ id?: string | null
+ lastCalibrationDate?: string | null
+ locationId?: string | null
+ modelNumber?: string | null
+ nextCalibrationDate?: string | null
+ serialNumber?: string | null
+ shelfId?: string | null
+ supplierId?: string | null
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Update: {
+ companyId?: string | null
+ createdAt?: string | null
+ createdBy?: string | null
+ customFields?: Json | null
+ dateAcquired?: string | null
+ description?: string | null
+ gaugeCalibrationStatus?:
+ | Database["public"]["Enums"]["gaugeCalibrationStatus"]
+ | null
+ gaugeCalibrationStatusWithDueDate?: never
+ gaugeId?: string | null
+ gaugeRole?: Database["public"]["Enums"]["gaugeRole"] | null
+ gaugeStatus?: Database["public"]["Enums"]["gaugeStatus"] | null
+ gaugeTypeId?: string | null
+ id?: string | null
+ lastCalibrationDate?: string | null
+ locationId?: string | null
+ modelNumber?: string | null
+ nextCalibrationDate?: string | null
+ serialNumber?: string | null
+ shelfId?: string | null
+ supplierId?: string | null
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Relationships: [
+ {
+ foreignKeyName: "gauge_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "companies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "company"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "customFieldTables"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "gauge_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "integrations"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "gauge_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ {
+ foreignKeyName: "gauge_gaugeTypeId_fkey"
+ columns: ["gaugeTypeId"]
+ isOneToOne: false
+ referencedRelation: "gaugeType"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_locationId_fkey"
+ columns: ["locationId"]
+ isOneToOne: false
+ referencedRelation: "location"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_shelfId_fkey"
+ columns: ["shelfId"]
+ isOneToOne: false
+ referencedRelation: "shelf"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_supplierId_fkey"
+ columns: ["supplierId"]
+ isOneToOne: false
+ referencedRelation: "contractors"
+ referencedColumns: ["supplierId"]
+ },
+ {
+ foreignKeyName: "gauge_supplierId_fkey"
+ columns: ["supplierId"]
+ isOneToOne: false
+ referencedRelation: "partners"
+ referencedColumns: ["supplierId"]
+ },
+ {
+ foreignKeyName: "gauge_supplierId_fkey"
+ columns: ["supplierId"]
+ isOneToOne: false
+ referencedRelation: "purchaseOrderSuppliers"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_supplierId_fkey"
+ columns: ["supplierId"]
+ isOneToOne: false
+ referencedRelation: "supplier"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_supplierId_fkey"
+ columns: ["supplierId"]
+ isOneToOne: false
+ referencedRelation: "suppliers"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ ]
+ }
groupMembers: {
Row: {
companyId: string | null
@@ -35457,14 +35922,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["supplierCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["supplierCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -37552,14 +38017,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["paymentCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["paymentCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -40652,6 +41117,12 @@ export type Database = {
| "Total Hours"
| "Total Minutes"
fulfillmentType: "Inventory" | "Job"
+ gaugeCalibrationStatus:
+ | "Pending"
+ | "In-Calibration"
+ | "Out-of-Calibration"
+ gaugeRole: "Master" | "Standard"
+ gaugeStatus: "Active" | "Inactive"
glAccountCategory:
| "Bank"
| "Accounts Receivable"
diff --git a/packages/database/supabase/functions/lib/seed.ts b/packages/database/supabase/functions/lib/seed.ts
index 37fa6ce49b..8d73698e10 100644
--- a/packages/database/supabase/functions/lib/seed.ts
+++ b/packages/database/supabase/functions/lib/seed.ts
@@ -1758,6 +1758,13 @@ export const sequences = [
size: 6,
step: 1,
},
+ {
+ table: "gauge",
+ name: "Gauge",
+ prefix: "G",
+ suffix: null,
+ next: 0,
+ },
{
table: "nonConformance",
name: "Non-Conformance",
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index b50ed403cb..5bd3536d2d 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -6173,6 +6173,233 @@ export type Database = {
},
]
}
+ gauge: {
+ Row: {
+ companyId: string | null
+ createdAt: string
+ createdBy: string
+ customFields: Json
+ dateAcquired: string | null
+ description: string | null
+ gaugeCalibrationStatus: Database["public"]["Enums"]["gaugeCalibrationStatus"]
+ gaugeId: string
+ gaugeRole: Database["public"]["Enums"]["gaugeRole"]
+ gaugeStatus: Database["public"]["Enums"]["gaugeStatus"]
+ gaugeTypeId: string
+ id: string
+ lastCalibrationDate: string | null
+ locationId: string | null
+ modelNumber: string | null
+ nextCalibrationDate: string | null
+ serialNumber: string | null
+ shelfId: string | null
+ supplierId: string | null
+ updatedAt: string | null
+ updatedBy: string | null
+ }
+ Insert: {
+ companyId?: string | null
+ createdAt?: string
+ createdBy: string
+ customFields?: Json
+ dateAcquired?: string | null
+ description?: string | null
+ gaugeCalibrationStatus?: Database["public"]["Enums"]["gaugeCalibrationStatus"]
+ gaugeId: string
+ gaugeRole?: Database["public"]["Enums"]["gaugeRole"]
+ gaugeStatus?: Database["public"]["Enums"]["gaugeStatus"]
+ gaugeTypeId: string
+ id?: string
+ lastCalibrationDate?: string | null
+ locationId?: string | null
+ modelNumber?: string | null
+ nextCalibrationDate?: string | null
+ serialNumber?: string | null
+ shelfId?: string | null
+ supplierId?: string | null
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Update: {
+ companyId?: string | null
+ createdAt?: string
+ createdBy?: string
+ customFields?: Json
+ dateAcquired?: string | null
+ description?: string | null
+ gaugeCalibrationStatus?: Database["public"]["Enums"]["gaugeCalibrationStatus"]
+ gaugeId?: string
+ gaugeRole?: Database["public"]["Enums"]["gaugeRole"]
+ gaugeStatus?: Database["public"]["Enums"]["gaugeStatus"]
+ gaugeTypeId?: string
+ id?: string
+ lastCalibrationDate?: string | null
+ locationId?: string | null
+ modelNumber?: string | null
+ nextCalibrationDate?: string | null
+ serialNumber?: string | null
+ shelfId?: string | null
+ supplierId?: string | null
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Relationships: [
+ {
+ foreignKeyName: "gauge_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "companies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "company"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "customFieldTables"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "gauge_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "integrations"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "gauge_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ {
+ foreignKeyName: "gauge_gaugeTypeId_fkey"
+ columns: ["gaugeTypeId"]
+ isOneToOne: false
+ referencedRelation: "gaugeType"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_locationId_fkey"
+ columns: ["locationId"]
+ isOneToOne: false
+ referencedRelation: "location"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_shelfId_fkey"
+ columns: ["shelfId"]
+ isOneToOne: false
+ referencedRelation: "shelf"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_supplierId_fkey"
+ columns: ["supplierId"]
+ isOneToOne: false
+ referencedRelation: "contractors"
+ referencedColumns: ["supplierId"]
+ },
+ {
+ foreignKeyName: "gauge_supplierId_fkey"
+ columns: ["supplierId"]
+ isOneToOne: false
+ referencedRelation: "partners"
+ referencedColumns: ["supplierId"]
+ },
+ {
+ foreignKeyName: "gauge_supplierId_fkey"
+ columns: ["supplierId"]
+ isOneToOne: false
+ referencedRelation: "purchaseOrderSuppliers"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_supplierId_fkey"
+ columns: ["supplierId"]
+ isOneToOne: false
+ referencedRelation: "supplier"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_supplierId_fkey"
+ columns: ["supplierId"]
+ isOneToOne: false
+ referencedRelation: "suppliers"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ ]
+ }
gaugeType: {
Row: {
companyId: string | null
@@ -32533,6 +32760,244 @@ export type Database = {
},
]
}
+ gauges: {
+ Row: {
+ companyId: string | null
+ createdAt: string | null
+ createdBy: string | null
+ customFields: Json | null
+ dateAcquired: string | null
+ description: string | null
+ gaugeCalibrationStatus:
+ | Database["public"]["Enums"]["gaugeCalibrationStatus"]
+ | null
+ gaugeCalibrationStatusWithDueDate:
+ | Database["public"]["Enums"]["gaugeCalibrationStatus"]
+ | null
+ gaugeId: string | null
+ gaugeRole: Database["public"]["Enums"]["gaugeRole"] | null
+ gaugeStatus: Database["public"]["Enums"]["gaugeStatus"] | null
+ gaugeTypeId: string | null
+ id: string | null
+ lastCalibrationDate: string | null
+ locationId: string | null
+ modelNumber: string | null
+ nextCalibrationDate: string | null
+ serialNumber: string | null
+ shelfId: string | null
+ supplierId: string | null
+ updatedAt: string | null
+ updatedBy: string | null
+ }
+ Insert: {
+ companyId?: string | null
+ createdAt?: string | null
+ createdBy?: string | null
+ customFields?: Json | null
+ dateAcquired?: string | null
+ description?: string | null
+ gaugeCalibrationStatus?:
+ | Database["public"]["Enums"]["gaugeCalibrationStatus"]
+ | null
+ gaugeCalibrationStatusWithDueDate?: never
+ gaugeId?: string | null
+ gaugeRole?: Database["public"]["Enums"]["gaugeRole"] | null
+ gaugeStatus?: Database["public"]["Enums"]["gaugeStatus"] | null
+ gaugeTypeId?: string | null
+ id?: string | null
+ lastCalibrationDate?: string | null
+ locationId?: string | null
+ modelNumber?: string | null
+ nextCalibrationDate?: string | null
+ serialNumber?: string | null
+ shelfId?: string | null
+ supplierId?: string | null
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Update: {
+ companyId?: string | null
+ createdAt?: string | null
+ createdBy?: string | null
+ customFields?: Json | null
+ dateAcquired?: string | null
+ description?: string | null
+ gaugeCalibrationStatus?:
+ | Database["public"]["Enums"]["gaugeCalibrationStatus"]
+ | null
+ gaugeCalibrationStatusWithDueDate?: never
+ gaugeId?: string | null
+ gaugeRole?: Database["public"]["Enums"]["gaugeRole"] | null
+ gaugeStatus?: Database["public"]["Enums"]["gaugeStatus"] | null
+ gaugeTypeId?: string | null
+ id?: string | null
+ lastCalibrationDate?: string | null
+ locationId?: string | null
+ modelNumber?: string | null
+ nextCalibrationDate?: string | null
+ serialNumber?: string | null
+ shelfId?: string | null
+ supplierId?: string | null
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Relationships: [
+ {
+ foreignKeyName: "gauge_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "companies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "company"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "customFieldTables"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "gauge_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "integrations"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "gauge_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ {
+ foreignKeyName: "gauge_gaugeTypeId_fkey"
+ columns: ["gaugeTypeId"]
+ isOneToOne: false
+ referencedRelation: "gaugeType"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_locationId_fkey"
+ columns: ["locationId"]
+ isOneToOne: false
+ referencedRelation: "location"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_shelfId_fkey"
+ columns: ["shelfId"]
+ isOneToOne: false
+ referencedRelation: "shelf"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_supplierId_fkey"
+ columns: ["supplierId"]
+ isOneToOne: false
+ referencedRelation: "contractors"
+ referencedColumns: ["supplierId"]
+ },
+ {
+ foreignKeyName: "gauge_supplierId_fkey"
+ columns: ["supplierId"]
+ isOneToOne: false
+ referencedRelation: "partners"
+ referencedColumns: ["supplierId"]
+ },
+ {
+ foreignKeyName: "gauge_supplierId_fkey"
+ columns: ["supplierId"]
+ isOneToOne: false
+ referencedRelation: "purchaseOrderSuppliers"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_supplierId_fkey"
+ columns: ["supplierId"]
+ isOneToOne: false
+ referencedRelation: "supplier"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_supplierId_fkey"
+ columns: ["supplierId"]
+ isOneToOne: false
+ referencedRelation: "suppliers"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "gauge_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ ]
+ }
groupMembers: {
Row: {
companyId: string | null
@@ -35457,14 +35922,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["supplierCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["supplierCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -37552,14 +38017,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["paymentCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["paymentCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -40652,6 +41117,12 @@ export type Database = {
| "Total Hours"
| "Total Minutes"
fulfillmentType: "Inventory" | "Job"
+ gaugeCalibrationStatus:
+ | "Pending"
+ | "In-Calibration"
+ | "Out-of-Calibration"
+ gaugeRole: "Master" | "Standard"
+ gaugeStatus: "Active" | "Inactive"
glAccountCategory:
| "Bank"
| "Accounts Receivable"
diff --git a/packages/database/supabase/migrations/20250502132738_gauge-calibration.sql b/packages/database/supabase/migrations/20250502132738_gauge-calibration.sql
index ee8bb04e50..09f5b4347b 100644
--- a/packages/database/supabase/migrations/20250502132738_gauge-calibration.sql
+++ b/packages/database/supabase/migrations/20250502132738_gauge-calibration.sql
@@ -97,4 +97,85 @@ SELECT
'system'
FROM
"company" c,
- nc_types;
\ No newline at end of file
+ nc_types;
+
+
+CREATE TYPE "gaugeStatus" AS ENUM (
+ 'Active',
+ 'Inactive'
+);
+
+
+CREATE TYPE "gaugeRole" AS ENUM (
+ 'Master',
+ 'Standard'
+);
+
+CREATE TYPE "gaugeCalibrationStatus" AS ENUM (
+ 'Pending',
+ 'In-Calibration',
+ 'Out-of-Calibration'
+);
+
+
+CREATE TABLE "gauge" (
+ "id" TEXT NOT NULL DEFAULT xid(),
+ "gaugeId" TEXT NOT NULL,
+ "supplierId" TEXT,
+ "modelNumber" TEXT,
+ "serialNumber" TEXT,
+ "description" TEXT,
+ "dateAcquired" DATE,
+ "gaugeTypeId" TEXT NOT NULL,
+ "gaugeCalibrationStatus" "gaugeCalibrationStatus" NOT NULL DEFAULT 'Pending',
+ "gaugeStatus" "gaugeStatus" NOT NULL DEFAULT 'Active',
+ "gaugeRole" "gaugeRole" NOT NULL DEFAULT 'Standard',
+ "lastCalibrationDate" DATE,
+ "nextCalibrationDate" DATE,
+ "locationId" TEXT,
+ "shelfId" TEXT,
+ "companyId" TEXT,
+ "customFields" JSON NOT NULL DEFAULT '{}',
+ "createdAt" TIMESTAMP WITH TIME ZONE DEFAULT NOW() NOT NULL,
+ "createdBy" TEXT NOT NULL,
+ "updatedAt" TIMESTAMP WITH TIME ZONE,
+ "updatedBy" TEXT,
+
+ CONSTRAINT "gauge_pkey" PRIMARY KEY ("id"),
+ CONSTRAINT "gauge_gaugeId_unique" UNIQUE ("gaugeId", "companyId"),
+ CONSTRAINT "gauge_supplierId_fkey" FOREIGN KEY ("supplierId") REFERENCES "supplier"("id") ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT "gauge_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company"("id") ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT "gauge_gaugeTypeId_fkey" FOREIGN KEY ("gaugeTypeId") REFERENCES "gaugeType"("id") ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT "gauge_locationId_fkey" FOREIGN KEY ("locationId") REFERENCES "location"("id") ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT "gauge_shelfId_fkey" FOREIGN KEY ("shelfId") REFERENCES "shelf"("id") ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT "gauge_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user"("id") ON UPDATE CASCADE,
+ CONSTRAINT "gauge_updatedBy_fkey" FOREIGN KEY ("updatedBy") REFERENCES "user"("id") ON UPDATE CASCADE
+);
+
+CREATE INDEX "gauge_companyId_idx" ON "gauge" ("companyId");
+CREATE INDEX "gauge_gaugeTypeId_idx" ON "gauge" ("gaugeTypeId");
+CREATE INDEX "gauge_locationId_idx" ON "gauge" ("locationId");
+CREATE INDEX "gauge_shelfId_idx" ON "gauge" ("shelfId");
+
+CREATE OR REPLACE VIEW "gauges" WITH(SECURITY_INVOKER=true) AS
+ SELECT
+ g.*,
+ CASE
+ WHEN g."gaugeStatus" = 'Inactive' THEN 'Out-of-Calibration'
+ WHEN g."nextCalibrationDate" IS NOT NULL AND g."nextCalibrationDate" < CURRENT_DATE THEN 'Out-of-Calibration'
+ ELSE g."gaugeCalibrationStatus"
+ END as "gaugeCalibrationStatusWithDueDate"
+FROM "gauge" g;
+
+
+INSERT INTO "sequence" ("table", "name", "prefix", "suffix", "next", "size", "step", "companyId")
+SELECT
+ 'gauge',
+ 'Gauge',
+ 'G',
+ NULL,
+ 0,
+ 6,
+ 1,
+ "id"
+FROM "company";
\ No newline at end of file
diff --git a/packages/database/supabase/migrations/20250502153813_job-dependency-rls.sql b/packages/database/supabase/migrations/20250502153813_job-dependency-rls.sql
new file mode 100644
index 0000000000..fa2eee3092
--- /dev/null
+++ b/packages/database/supabase/migrations/20250502153813_job-dependency-rls.sql
@@ -0,0 +1,9 @@
+ALTER TABLE "jobOperationDependency" ENABLE ROW LEVEL SECURITY;
+CREATE POLICY "Employees can view job operation dependencies" ON "jobOperationDependency"
+ FOR SELECT
+ USING (
+ has_role('employee', "companyId") AND
+ "companyId" = ANY(
+ select "companyId" from "userToCompany" where "userId" = auth.uid()::text
+ )
+ );
\ No newline at end of file