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 pick list table

Brad Barbin1e2d7a561f64
diff --git a/apps/erp/app/modules/inventory/inventory.service.ts b/apps/erp/app/modules/inventory/inventory.service.ts
index cac0a59e29..b3f9a5169c 100644
--- a/apps/erp/app/modules/inventory/inventory.service.ts
+++ b/apps/erp/app/modules/inventory/inventory.service.ts
@@ -235,6 +235,30 @@ export async function getKanban(
return client.from("kanbans").select("*").eq("id", kanbanId).single();
}
+export async function getPickLists(
+ client: SupabaseClient<Database>,
+ companyId: string,
+ args: GenericQueryFilters & {
+ search: string | null;
+ }
+) {
+ let query = client
+ .from("pickList")
+ .select("*", {
+ count: "exact",
+ })
+ .eq("companyId", companyId);
+
+ if (args.search) {
+ query = query.ilike("pickListId", `%${args.search}%`);
+ }
+
+ query = setGenericQueryFilters(query, args, [
+ { column: "shipmentId", ascending: false },
+ ]);
+ return query;
+}
+
export async function getReceipts(
client: SupabaseClient<Database>,
companyId: string,
diff --git a/apps/erp/app/modules/inventory/types.ts b/apps/erp/app/modules/inventory/types.ts
index c5651bdc06..1c8b61c413 100644
--- a/apps/erp/app/modules/inventory/types.ts
+++ b/apps/erp/app/modules/inventory/types.ts
@@ -4,6 +4,7 @@ import type {
getInventoryItems,
getItemLedgerPage,
getKanbans,
+ getPickLists,
getReceiptLines,
getReceiptTracking,
getReceipts,
@@ -20,10 +21,6 @@ export type BatchProperty = NonNullable<
Awaited<ReturnType<typeof getBatchProperties>>["data"]
>[number];
-export type Kanban = NonNullable<
- Awaited<ReturnType<typeof getKanbans>>["data"]
->[number];
-
export type InventoryItem = NonNullable<
Awaited<ReturnType<typeof getInventoryItems>>["data"]
>[number];
@@ -40,6 +37,14 @@ export type Receipt = NonNullable<
Awaited<ReturnType<typeof getReceipts>>["data"]
>[number];
+export type Kanban = NonNullable<
+ Awaited<ReturnType<typeof getKanbans>>["data"]
+>[number];
+
+export type PickList = NonNullable<
+ Awaited<ReturnType<typeof getPickLists>>["data"]
+>[number];
+
export type ReceiptLine = NonNullable<
Awaited<ReturnType<typeof getReceiptLines>>["data"]
>[number];
diff --git a/apps/erp/app/modules/inventory/ui/PickLists/PickListStatus.tsx b/apps/erp/app/modules/inventory/ui/PickLists/PickListStatus.tsx
new file mode 100644
index 0000000000..060a789124
--- /dev/null
+++ b/apps/erp/app/modules/inventory/ui/PickLists/PickListStatus.tsx
@@ -0,0 +1,25 @@
+import { Status } from "@carbon/react";
+import type { pickListStatusType } from "~/modules/inventory";
+
+type PickListStatusProps = {
+ status?: (typeof pickListStatusType)[number] | null;
+ invoiced?: boolean | null;
+ voided?: boolean | null;
+};
+
+const PickListStatus = ({ status, invoiced, voided }: PickListStatusProps) => {
+ switch (status) {
+ case "Draft":
+ return <Status color="gray">{status}</Status>;
+ case "Released":
+ return <Status color="orange">{status}</Status>;
+ case "In Progress":
+ return <Status color="blue">{status}</Status>;
+ case "Completed":
+ return <Status color="green">{status}</Status>;
+ default:
+ return null;
+ }
+};
+
+export default PickListStatus;
diff --git a/apps/erp/app/modules/inventory/ui/PickLists/PickListsTable.tsx b/apps/erp/app/modules/inventory/ui/PickLists/PickListsTable.tsx
new file mode 100644
index 0000000000..4ae424696f
--- /dev/null
+++ b/apps/erp/app/modules/inventory/ui/PickLists/PickListsTable.tsx
@@ -0,0 +1,284 @@
+import { MenuIcon, MenuItem, useDisclosure } from "@carbon/react";
+import { formatDate } from "@carbon/utils";
+import { useNavigate } from "@remix-run/react";
+import type { ColumnDef } from "@tanstack/react-table";
+import { memo, useCallback, useMemo, useState } from "react";
+import {
+ LuBookMarked,
+ LuCalendar,
+ LuClock,
+ LuMapPin,
+ LuPencil,
+ LuTrash,
+ LuUser,
+} from "react-icons/lu";
+import { EmployeeAvatar, Hyperlink, New, Table } from "~/components";
+import { Enumerable } from "~/components/Enumerable";
+import { useLocations } from "~/components/Form/Location";
+import { ConfirmDelete } from "~/components/Modals";
+import { usePermissions, useRealtime, useUrlParams } from "~/hooks";
+import { useCustomColumns } from "~/hooks/useCustomColumns";
+import { usePeople } from "~/stores";
+import { path } from "~/utils/path";
+import { pickListStatusType } from "../../inventory.models";
+import type { PickList } from "../../types";
+import PickListStatus from "./PickListStatus";
+
+type PickListsTableProps = {
+ data: PickList[];
+ count: number;
+};
+
+const PickListsTable = memo(({ data, count }: PickListsTableProps) => {
+ useRealtime("shipment", `id=in.(${data.map((d) => d.id).join(",")})`);
+
+ const [params] = useUrlParams();
+ const navigate = useNavigate();
+ const permissions = usePermissions();
+
+ const rows = useMemo(() => data, [data]);
+ const [people] = usePeople();
+
+ const customColumns = useCustomColumns<PickList>("pickList");
+ const locations = useLocations();
+
+ const columns = useMemo<ColumnDef<PickList>[]>(() => {
+ const result: ColumnDef<(typeof rows)[number]>[] = [
+ {
+ accessorKey: "pickListId",
+ header: "Pick List ID",
+ cell: ({ row }) => (
+ <Hyperlink to={path.to.pickListDetails(row.original.id!)}>
+ {row.original.pickListId}
+ </Hyperlink>
+ ),
+ meta: {
+ icon: <LuBookMarked />,
+ },
+ },
+ {
+ accessorKey: "locationId",
+ header: "Location",
+ cell: ({ row }) => (
+ <Enumerable
+ value={
+ locations.find((l) => l.value === row.original.locationId)
+ ?.label ?? null
+ }
+ />
+ ),
+ meta: {
+ filter: {
+ type: "static",
+ options: locations.map((type) => ({
+ value: type.value,
+ label: <Enumerable value={type.label} />,
+ })),
+ },
+ icon: <LuMapPin />,
+ },
+ },
+ {
+ accessorKey: "status",
+ header: "Status",
+ cell: (item) => {
+ const status = item.getValue<(typeof pickListStatusType)[number]>();
+ return <PickListStatus status={status} />;
+ },
+ meta: {
+ filter: {
+ type: "static",
+ options: pickListStatusType.map((type) => ({
+ value: type,
+ label: <PickListStatus status={type} />,
+ })),
+ },
+ pluralHeader: "Statuses",
+ icon: <LuClock />,
+ },
+ },
+ {
+ accessorKey: "assignee",
+ header: "Assignee",
+ cell: ({ row }) => (
+ <EmployeeAvatar employeeId={row.original.assignee} />
+ ),
+ meta: {
+ filter: {
+ type: "static",
+ options: people.map((employee) => ({
+ value: employee.id,
+ label: employee.name,
+ })),
+ },
+ icon: <LuUser />,
+ },
+ },
+ {
+ accessorKey: "assignee",
+ header: "Assignee",
+ cell: ({ row }) => (
+ <EmployeeAvatar employeeId={row.original.assignee} />
+ ),
+ meta: {
+ filter: {
+ type: "static",
+ options: people.map((employee) => ({
+ value: employee.id,
+ label: employee.name,
+ })),
+ },
+ icon: <LuUser />,
+ },
+ },
+ {
+ accessorKey: "completedAt",
+ header: "Created At",
+ cell: (item) => formatDate(item.getValue<string>()),
+ meta: {
+ icon: <LuCalendar />,
+ },
+ },
+ {
+ id: "createdBy",
+ header: "Created By",
+ cell: ({ row }) => (
+ <EmployeeAvatar employeeId={row.original.createdBy} />
+ ),
+ meta: {
+ filter: {
+ type: "static",
+ options: people.map((employee) => ({
+ value: employee.id,
+ label: employee.name,
+ })),
+ },
+ icon: <LuUser />,
+ },
+ },
+ {
+ accessorKey: "createdAt",
+ header: "Created At",
+ cell: (item) => formatDate(item.getValue<string>()),
+ meta: {
+ icon: <LuCalendar />,
+ },
+ },
+ {
+ id: "updatedBy",
+ header: "Updated By",
+ cell: ({ row }) => (
+ <EmployeeAvatar employeeId={row.original.updatedBy} />
+ ),
+ meta: {
+ filter: {
+ type: "static",
+ options: people.map((employee) => ({
+ value: employee.id,
+ label: employee.name,
+ })),
+ },
+ icon: <LuUser />,
+ },
+ },
+ {
+ accessorKey: "updatedAt",
+ header: "Updated At",
+ cell: (item) => formatDate(item.getValue<string>()),
+ meta: {
+ icon: <LuCalendar />,
+ },
+ },
+ ];
+
+ return [...result, ...customColumns];
+ }, [locations, people, customColumns]);
+
+ const [selectedPickList, setSelectedPickList] = useState<PickList | null>(
+ null
+ );
+ const deletePickListModal = useDisclosure();
+
+ const renderContextMenu = useCallback(
+ (row: PickList) => {
+ return (
+ <>
+ <MenuItem
+ disabled={!permissions.can("update", "inventory")}
+ onClick={() => {
+ navigate(
+ `${path.to.shipmentDetails(row.id!)}?${params.toString()}`
+ );
+ }}
+ >
+ <MenuIcon icon={<LuPencil />} />
+ {row.completedAt ? "View Pick List" : "Edit Pick List"}
+ </MenuItem>
+ <MenuItem
+ disabled={
+ !permissions.can("delete", "inventory") ||
+ !!row.completedAt ||
+ row.status === "Completed"
+ }
+ destructive
+ onClick={() => {
+ setSelectedPickList(row);
+ deletePickListModal.onOpen();
+ }}
+ >
+ <MenuIcon icon={<LuTrash />} />
+ Delete Pick List
+ </MenuItem>
+ </>
+ );
+ },
+ [deletePickListModal, navigate, params, permissions]
+ );
+
+ return (
+ <>
+ <Table<(typeof data)[number]>
+ data={data}
+ columns={columns}
+ count={count}
+ defaultColumnPinning={{
+ left: ["shipmentId"],
+ }}
+ defaultColumnVisibility={{
+ createdAt: false,
+ createdBy: false,
+ updatedAt: false,
+ updatedBy: false,
+ }}
+ primaryAction={
+ permissions.can("create", "inventory") && (
+ <New label="PickList" to={path.to.newPickList} />
+ )
+ }
+ renderContextMenu={renderContextMenu}
+ title="Pick Lists"
+ table="pickList"
+ withSavedView
+ />
+ {selectedPickList && selectedPickList.id && (
+ <ConfirmDelete
+ action={path.to.deletePickList(selectedPickList.id)}
+ isOpen={deletePickListModal.isOpen}
+ name={selectedPickList.pickListId!}
+ text={`Are you sure you want to delete ${selectedPickList.pickListId!}? This cannot be undone.`}
+ onCancel={() => {
+ deletePickListModal.onClose();
+ setSelectedPickList(null);
+ }}
+ onSubmit={() => {
+ deletePickListModal.onClose();
+ setSelectedPickList(null);
+ }}
+ />
+ )}
+ </>
+ );
+});
+
+PickListsTable.displayName = "PickListsTable";
+export default PickListsTable;
diff --git a/apps/erp/app/modules/inventory/ui/useInventorySubmodules.tsx b/apps/erp/app/modules/inventory/ui/useInventorySubmodules.tsx
index 3259b4f3c4..e84bc1fa1b 100644
--- a/apps/erp/app/modules/inventory/ui/useInventorySubmodules.tsx
+++ b/apps/erp/app/modules/inventory/ui/useInventorySubmodules.tsx
@@ -1,6 +1,7 @@
import {
LuArrowRightLeft,
LuHandCoins,
+ LuListChecks,
LuNetwork,
LuQrCode,
LuTally5,
@@ -16,6 +17,12 @@ const inventoryRoutes: AuthenticatedRouteGroup[] = [
{
name: "Manage",
routes: [
+ {
+ name: "Pick Lists",
+ to: path.to.pickLists,
+ icon: <LuListChecks />,
+ table: "pickList",
+ },
{
name: "Receipts",
to: path.to.receipts,
diff --git a/apps/erp/app/routes/x+/inventory+/pick-lists.tsx b/apps/erp/app/routes/x+/inventory+/pick-lists.tsx
new file mode 100644
index 0000000000..6b71c06ee2
--- /dev/null
+++ b/apps/erp/app/routes/x+/inventory+/pick-lists.tsx
@@ -0,0 +1,62 @@
+import { error } from "@carbon/auth";
+import { requirePermissions } from "@carbon/auth/auth.server";
+import { flash } from "@carbon/auth/session.server";
+import { VStack } from "@carbon/react";
+import { Outlet, useLoaderData } from "@remix-run/react";
+import type { LoaderFunctionArgs } from "@vercel/remix";
+import { json, redirect } from "@vercel/remix";
+import { getPickLists } from "~/modules/inventory";
+import PickListsTable from "~/modules/inventory/ui/PickLists/PickListsTable";
+import type { Handle } from "~/utils/handle";
+import { path } from "~/utils/path";
+import { getGenericQueryFilters } from "~/utils/query";
+
+export const handle: Handle = {
+ breadcrumb: "Pick Lists",
+ to: path.to.pickLists,
+};
+
+export async function loader({ request }: LoaderFunctionArgs) {
+ const { client, companyId } = await requirePermissions(request, {
+ view: "inventory",
+ });
+
+ 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 [pickLists] = await Promise.all([
+ getPickLists(client, companyId, {
+ search,
+ limit,
+ offset,
+ sorts,
+ filters,
+ }),
+ ]);
+
+ if (pickLists.error) {
+ throw redirect(
+ path.to.authenticatedRoot,
+ await flash(request, error(null, "Error loading pickLists"))
+ );
+ }
+
+ return json({
+ pickLists: pickLists.data ?? [],
+ count: pickLists.count ?? 0,
+ });
+}
+
+export default function PickListsRoute() {
+ const { pickLists, count } = useLoaderData<typeof loader>();
+
+ return (
+ <VStack spacing={0} className="h-full">
+ <PickListsTable data={pickLists} count={count ?? 0} />
+ <Outlet />
+ </VStack>
+ );
+}
diff --git a/apps/erp/app/utils/path.ts b/apps/erp/app/utils/path.ts
index e6ee1b4559..9d95353d22 100644
--- a/apps/erp/app/utils/path.ts
+++ b/apps/erp/app/utils/path.ts
@@ -582,6 +582,8 @@ export const path = {
generatePath(`${x}/resources/partners/delete/${id}`),
deletePaymentTerm: (id: string) =>
generatePath(`${x}/accounting/payment-terms/delete/${id}`),
+ deletePickList: (id: string) =>
+ generatePath(`${x}/inventory/pick-lists/${id}/delete`),
deleteProcedure: (id: string) =>
generatePath(`${x}/procedure/delete/${id}`),
deleteProcedureStep: (id: string, stepId: string) =>
@@ -932,6 +934,7 @@ export const path = {
newPart: `${x}/part/new`,
newPartSupplier: (id: string) =>
generatePath(`${x}/part/${id}/view/purchasing/new`),
+ newPickList: `${x}/inventory/pick-lists/new`,
newProcedure: `${x}/production/procedures/new`,
newProcedureStep: (id: string) =>
generatePath(`${x}/procedure/${id}/steps/new`),
@@ -1054,6 +1057,12 @@ export const path = {
person: (id: string) => generatePath(`${x}/person/${id}`),
personDetails: (id: string) => generatePath(`${x}/person/${id}/details`),
personJob: (id: string) => generatePath(`${x}/person/${id}/job`),
+ pickLists: `${x}/inventory/pick-lists`,
+ pickList: (id: string) => generatePath(`${x}/inventory/pick-lists/${id}`),
+ pickListDetails: (id: string) =>
+ generatePath(`${x}/inventory/pick-lists/${id}/details`),
+ pickListStatus: (id: string) =>
+ generatePath(`${x}/inventory/pick-lists/${id}/status`),
procedure: (id: string) => generatePath(`${x}/procedure/${id}`),
procedureStep: (id: string, attributeId: string) =>
generatePath(`${x}/procedure/${id}/steps/${attributeId}`),
diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.ts
index 433d656f56..fade537cbe 100644
--- a/packages/database/src/swagger-docs-schema.ts
+++ b/packages/database/src/swagger-docs-schema.ts
@@ -8568,6 +8568,9 @@ export default {
{
$ref: "#/parameters/rowFilter.jobMaterialWithMakeMethodId.kit",
},
+ {
+ $ref: "#/parameters/rowFilter.jobMaterialWithMakeMethodId.shelfName",
+ },
{
$ref: "#/parameters/rowFilter.jobMaterialWithMakeMethodId.jobMaterialMakeMethodId",
},
@@ -9639,6 +9642,9 @@ export default {
{
$ref: "#/parameters/rowFilter.quoteMaterialWithMakeMethodId.kit",
},
+ {
+ $ref: "#/parameters/rowFilter.quoteMaterialWithMakeMethodId.shelfId",
+ },
{
$ref: "#/parameters/rowFilter.quoteMaterialWithMakeMethodId.quoteMaterialMakeMethodId",
},
@@ -28143,6 +28149,9 @@ export default {
{
$ref: "#/parameters/rowFilter.quoteMaterial.kit",
},
+ {
+ $ref: "#/parameters/rowFilter.quoteMaterial.shelfId",
+ },
{
$ref: "#/parameters/select",
},
@@ -28271,6 +28280,9 @@ export default {
{
$ref: "#/parameters/rowFilter.quoteMaterial.kit",
},
+ {
+ $ref: "#/parameters/rowFilter.quoteMaterial.shelfId",
+ },
{
$ref: "#/parameters/preferReturn",
},
@@ -28353,6 +28365,9 @@ export default {
{
$ref: "#/parameters/rowFilter.quoteMaterial.kit",
},
+ {
+ $ref: "#/parameters/rowFilter.quoteMaterial.shelfId",
+ },
{
$ref: "#/parameters/body.quoteMaterial",
},
@@ -47824,10 +47839,7 @@ export default {
$ref: "#/parameters/rowFilter.pickList.status",
},
{
- $ref: "#/parameters/rowFilter.pickList.createdDate",
- },
- {
- $ref: "#/parameters/rowFilter.pickList.completedDate",
+ $ref: "#/parameters/rowFilter.pickList.completedAt",
},
{
$ref: "#/parameters/rowFilter.pickList.companyId",
@@ -47844,6 +47856,9 @@ export default {
{
$ref: "#/parameters/rowFilter.pickList.updatedBy",
},
+ {
+ $ref: "#/parameters/rowFilter.pickList.assignee",
+ },
{
$ref: "#/parameters/rowFilter.pickList.customFields",
},
@@ -47922,10 +47937,7 @@ export default {
$ref: "#/parameters/rowFilter.pickList.status",
},
{
- $ref: "#/parameters/rowFilter.pickList.createdDate",
- },
- {
- $ref: "#/parameters/rowFilter.pickList.completedDate",
+ $ref: "#/parameters/rowFilter.pickList.completedAt",
},
{
$ref: "#/parameters/rowFilter.pickList.companyId",
@@ -47942,6 +47954,9 @@ export default {
{
$ref: "#/parameters/rowFilter.pickList.updatedBy",
},
+ {
+ $ref: "#/parameters/rowFilter.pickList.assignee",
+ },
{
$ref: "#/parameters/rowFilter.pickList.customFields",
},
@@ -47974,10 +47989,7 @@ export default {
$ref: "#/parameters/rowFilter.pickList.status",
},
{
- $ref: "#/parameters/rowFilter.pickList.createdDate",
- },
- {
- $ref: "#/parameters/rowFilter.pickList.completedDate",
+ $ref: "#/parameters/rowFilter.pickList.completedAt",
},
{
$ref: "#/parameters/rowFilter.pickList.companyId",
@@ -47994,6 +48006,9 @@ export default {
{
$ref: "#/parameters/rowFilter.pickList.updatedBy",
},
+ {
+ $ref: "#/parameters/rowFilter.pickList.assignee",
+ },
{
$ref: "#/parameters/rowFilter.pickList.customFields",
},
@@ -63156,7 +63171,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",
},
@@ -63205,7 +63220,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",
},
@@ -63473,6 +63488,10 @@ export default {
format: "boolean",
type: "boolean",
},
+ shelfName: {
+ format: "text",
+ type: "string",
+ },
jobMaterialMakeMethodId: {
description: "Note:\nThis is a Primary Key.<pk/>",
format: "text",
@@ -64003,6 +64022,12 @@ export default {
format: "boolean",
type: "boolean",
},
+ shelfId: {
+ description:
+ "Note:\nThis is a Foreign Key to `shelf.id`.<fk table='shelf' column='id'/>",
+ format: "text",
+ type: "string",
+ },
quoteMaterialMakeMethodId: {
description: "Note:\nThis is a Primary Key.<pk/>",
format: "text",
@@ -72715,6 +72740,12 @@ export default {
format: "boolean",
type: "boolean",
},
+ shelfId: {
+ description:
+ "Note:\nThis is a Foreign Key to `shelf.id`.<fk table='shelf' column='id'/>",
+ format: "text",
+ type: "string",
+ },
},
type: "object",
},
@@ -82151,7 +82182,6 @@ export default {
"pickListId",
"locationId",
"status",
- "createdDate",
"companyId",
"createdAt",
"createdBy",
@@ -82179,12 +82209,7 @@ export default {
format: 'public."pickListStatus"',
type: "string",
},
- createdDate: {
- default: "now()",
- format: "timestamp with time zone",
- type: "string",
- },
- completedDate: {
+ completedAt: {
format: "timestamp with time zone",
type: "string",
},
@@ -82215,6 +82240,12 @@ export default {
format: "text",
type: "string",
},
+ assignee: {
+ description:
+ "Note:\nThis is a Foreign Key to `user.id`.<fk table='user' column='id'/>",
+ format: "text",
+ type: "string",
+ },
customFields: {
format: "jsonb",
},
@@ -90441,6 +90472,12 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.jobMaterialWithMakeMethodId.shelfName": {
+ name: "shelfName",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"rowFilter.jobMaterialWithMakeMethodId.jobMaterialMakeMethodId": {
name: "jobMaterialMakeMethodId",
required: false,
@@ -91089,6 +91126,12 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.quoteMaterialWithMakeMethodId.shelfId": {
+ name: "shelfId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"rowFilter.quoteMaterialWithMakeMethodId.quoteMaterialMakeMethodId": {
name: "quoteMaterialMakeMethodId",
required: false,
@@ -100812,6 +100855,12 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.quoteMaterial.shelfId": {
+ name: "shelfId",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"body.customerStatus": {
name: "customerStatus",
description: "customerStatus",
@@ -111606,14 +111655,8 @@ export default {
in: "query",
type: "string",
},
- "rowFilter.pickList.createdDate": {
- name: "createdDate",
- required: false,
- in: "query",
- type: "string",
- },
- "rowFilter.pickList.completedDate": {
- name: "completedDate",
+ "rowFilter.pickList.completedAt": {
+ name: "completedAt",
required: false,
in: "query",
type: "string",
@@ -111648,6 +111691,12 @@ export default {
in: "query",
type: "string",
},
+ "rowFilter.pickList.assignee": {
+ name: "assignee",
+ required: false,
+ in: "query",
+ type: "string",
+ },
"rowFilter.pickList.customFields": {
name: "customFields",
required: false,
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index f925ae36fa..62bb3cb52e 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -18497,11 +18497,11 @@ export type Database = {
}
pickList: {
Row: {
+ assignee: string | null
companyId: string
- completedDate: string | null
+ completedAt: string | null
createdAt: string
createdBy: string
- createdDate: string
customFields: Json | null
id: string
locationId: string
@@ -18512,11 +18512,11 @@ export type Database = {
updatedBy: string | null
}
Insert: {
+ assignee?: string | null
companyId: string
- completedDate?: string | null
+ completedAt?: string | null
createdAt?: string
createdBy: string
- createdDate?: string
customFields?: Json | null
id?: string
locationId: string
@@ -18527,11 +18527,11 @@ export type Database = {
updatedBy?: string | null
}
Update: {
+ assignee?: string | null
companyId?: string
- completedDate?: string | null
+ completedAt?: string | null
createdAt?: string
createdBy?: string
- createdDate?: string
customFields?: Json | null
id?: string
locationId?: string
@@ -18542,6 +18542,41 @@ export type Database = {
updatedBy?: string | null
}
Relationships: [
+ {
+ foreignKeyName: "pickList_assignee_fkey"
+ columns: ["assignee"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_assignee_fkey"
+ columns: ["assignee"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_assignee_fkey"
+ columns: ["assignee"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_assignee_fkey"
+ columns: ["assignee"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_assignee_fkey"
+ columns: ["assignee"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
{
foreignKeyName: "pickList_companyId_fkey"
columns: ["companyId"]
@@ -41488,14 +41523,14 @@ export type Database = {
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["supplierLocationId"]
+ columns: ["id"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["id"]
+ columns: ["supplierLocationId"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
@@ -42859,14 +42894,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"]
@@ -45921,14 +45956,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["paymentCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["paymentCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index f925ae36fa..62bb3cb52e 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -18497,11 +18497,11 @@ export type Database = {
}
pickList: {
Row: {
+ assignee: string | null
companyId: string
- completedDate: string | null
+ completedAt: string | null
createdAt: string
createdBy: string
- createdDate: string
customFields: Json | null
id: string
locationId: string
@@ -18512,11 +18512,11 @@ export type Database = {
updatedBy: string | null
}
Insert: {
+ assignee?: string | null
companyId: string
- completedDate?: string | null
+ completedAt?: string | null
createdAt?: string
createdBy: string
- createdDate?: string
customFields?: Json | null
id?: string
locationId: string
@@ -18527,11 +18527,11 @@ export type Database = {
updatedBy?: string | null
}
Update: {
+ assignee?: string | null
companyId?: string
- completedDate?: string | null
+ completedAt?: string | null
createdAt?: string
createdBy?: string
- createdDate?: string
customFields?: Json | null
id?: string
locationId?: string
@@ -18542,6 +18542,41 @@ export type Database = {
updatedBy?: string | null
}
Relationships: [
+ {
+ foreignKeyName: "pickList_assignee_fkey"
+ columns: ["assignee"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_assignee_fkey"
+ columns: ["assignee"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_assignee_fkey"
+ columns: ["assignee"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_assignee_fkey"
+ columns: ["assignee"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "pickList_assignee_fkey"
+ columns: ["assignee"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
{
foreignKeyName: "pickList_companyId_fkey"
columns: ["companyId"]
@@ -41488,14 +41523,14 @@ export type Database = {
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["supplierLocationId"]
+ columns: ["id"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
},
{
foreignKeyName: "partner_id_fkey"
- columns: ["id"]
+ columns: ["supplierLocationId"]
isOneToOne: false
referencedRelation: "supplierLocation"
referencedColumns: ["id"]
@@ -42859,14 +42894,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"]
@@ -45921,14 +45956,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["paymentCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["paymentCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
diff --git a/packages/database/supabase/migrations/20251007014240_pick-lists.sql b/packages/database/supabase/migrations/20251007014240_pick-lists.sql
index cfa98db81b..3278a3b1d7 100644
--- a/packages/database/supabase/migrations/20251007014240_pick-lists.sql
+++ b/packages/database/supabase/migrations/20251007014240_pick-lists.sql
@@ -77,17 +77,18 @@ CREATE TABLE "pickList" (
"pickListId" TEXT NOT NULL,
"locationId" TEXT NOT NULL,
"status" "pickListStatus" NOT NULL DEFAULT 'Draft',
- "createdDate" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
- "completedDate" TIMESTAMP WITH TIME ZONE,
+ "completedAt" TIMESTAMP WITH TIME ZONE,
"companyId" TEXT NOT NULL,
"createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT now(),
"createdBy" TEXT NOT NULL,
"updatedAt" TIMESTAMP WITH TIME ZONE,
"updatedBy" TEXT,
+ "assignee" TEXT,
"customFields" JSONB,
"tags" TEXT[],
CONSTRAINT "pickList_pkey" PRIMARY KEY ("id", "companyId"),
+ CONSTRAINT "pickList_assignee_fkey" FOREIGN KEY ("assignee") REFERENCES "user" ("id") ON DELETE SET NULL ON UPDATE CASCADE,
CONSTRAINT "pickList_locationId_fkey" FOREIGN KEY ("locationId") REFERENCES "location" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,
CONSTRAINT "pickList_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company" ("id") ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT "pickList_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user" ("id") ON DELETE RESTRICT ON UPDATE CASCADE,