diff --git a/backend/db/schema/dockdoor.scans.schema.ts b/backend/db/schema/dockdoor.scans.schema.ts new file mode 100644 index 0000000..8ce283c --- /dev/null +++ b/backend/db/schema/dockdoor.scans.schema.ts @@ -0,0 +1,23 @@ +import { pgTable, text, timestamp, uuid } from "drizzle-orm/pg-core"; +import { createInsertSchema, createSelectSchema } from "drizzle-zod"; +import type { z } from "zod"; + +export const dockDoorScans = pgTable("dock_door_scans", { + id: uuid("id").defaultRandom().primaryKey(), + dockId: text("dock_id").notNull(), + loadingOrder: text("loading_order").notNull(), + loadingUnit: text("loading_Unit").unique(), // can be running number or sscc depending on where it came from + loadingUnitStatus: text("loading_unit_status").default("loaded"), // TODO: add enums on the status of each load. + message: text("message"), // the response it gave when scanning + status: text("status").default("active"), // TODO: add in enums for this + add_date: timestamp("add_date", { withTimezone: true }).defaultNow(), + add_user: text("add_user").default("lst-system"), + upd_date: timestamp("upd_date", { withTimezone: true }).defaultNow(), + upd_user: text("upd_user").default("lst-system"), +}); + +export const dockDoorScansSchema = createSelectSchema(dockDoorScans); +export const newDockDoorScansSchema = createInsertSchema(dockDoorScans); + +export type DockDoorScans = z.infer; +export type NewDockDoorScans = z.infer; diff --git a/backend/dockdoorScanning/dockdoor.closeLoadingOrder.route.ts b/backend/dockdoorScanning/dockdoor.closeLoadingOrder.route.ts index f4b2cd8..946100e 100644 --- a/backend/dockdoorScanning/dockdoor.closeLoadingOrder.route.ts +++ b/backend/dockdoorScanning/dockdoor.closeLoadingOrder.route.ts @@ -2,7 +2,9 @@ import { eq, sql } from "drizzle-orm"; import { Router } from "express"; import z from "zod"; import { db } from "../db/db.controller.js"; +import { dockDoorScans } from "../db/schema/dockdoor.scans.schema.js"; import { dockDoorScanners } from "../db/schema/dockdoor.schema.js"; +import { runProdApi } from "../utils/prodEndpoint.utils.js"; import { apiReturn } from "../utils/returnHelper.utils.js"; import { tryCatch } from "../utils/trycatch.utils.js"; @@ -14,20 +16,52 @@ const endLoading = z.object({ }); r.post("/", async (req, res) => { - // close the loading order - - // clear the loading order off the dock + // TODO: setup the emitter to just emit the data when we post to the db try { const validated = endLoading.parse(req.body); + const orders = (await runProdApi({ + method: "post", + endpoint: `/public/v1.0/OutboundDeliveries/LoadingOrders/${req.body.loadingOrder}/Finish`, + data: [ + { + printDeliveryDocuments: true, + }, + ], + })) as any; + + if (orders?.data.errors) { + console.log(orders.data.errors); + return apiReturn(res, { + success: false, + level: "error", + module: "dockdoor", + subModule: "loadingOrder", + message: `Failed to finish the order.`, + data: (orders.data.errors as any) ?? [], + status: 400, + }); + } + + await tryCatch( + db + .update(dockDoorScans) + .set({ + upd_date: sql`NOW()`, + upd_user: req.user?.username ?? "lst-dock-system", + }) + .where(eq(dockDoorScanners.currentLoadingOrder, validated.loadingOrder)) + .returning(), + ); + const { data, error } = await tryCatch( db .update(dockDoorScanners) .set({ currentLoadingOrder: "", upd_date: sql`NOW()`, - upd_user: req.user?.username, + upd_user: req.user?.username ?? "lst-dock-system", }) .where(eq(dockDoorScanners.dockId, validated.dockId)) .returning(), @@ -46,13 +80,15 @@ r.post("/", async (req, res) => { } return apiReturn(res, { - success: true, - level: "info", + success: orders.data.errors ? false : true, + level: orders.data.errors ? "error" : "info", module: "dockdoor", subModule: "loadingOrder", - message: `Loading order ${validated.loadingOrder} was just closed.`, + message: orders.data.errors + ? `Loading order was cleared but encountered an error: \n${orders.data.errors[0].message} \nPossible reason for this is the loading order was completed via scanner or other means.` + : `Loading order ${validated.loadingOrder} was just closed.`, data: data ?? [], - status: 200, + status: orders.data.errors ? 400 : 200, }); } catch (error) { return apiReturn(res, { @@ -60,7 +96,7 @@ r.post("/", async (req, res) => { level: "error", module: "dockdoor", subModule: "loadingOrder", - message: `Failed to start loading order.`, + message: `Failed to Close loading order.`, data: (error as any) ?? [], status: 400, }); diff --git a/backend/dockdoorScanning/dockdoor.loadUnits.ts b/backend/dockdoorScanning/dockdoor.loadUnits.ts index 5598028..9c693a8 100644 --- a/backend/dockdoorScanning/dockdoor.loadUnits.ts +++ b/backend/dockdoorScanning/dockdoor.loadUnits.ts @@ -2,6 +2,7 @@ import { eq } from "drizzle-orm"; import { db } from "../db/db.controller.js"; +import { dockDoorScans } from "../db/schema/dockdoor.scans.schema.js"; import { dockDoorScanners } from "../db/schema/dockdoor.schema.js"; import { emitToRoom } from "../socket.io/roomEmitter.socket.js"; import { runProdApi } from "../utils/prodEndpoint.utils.js"; @@ -15,12 +16,35 @@ type Data = { runningNo?: string; }; +const postScan = async (data: any) => { + try { + await db.insert(dockDoorScans).values({ + dockId: data.dockId, + loadingOrder: data.loadingOrder, + loadingUnit: data.unit, // can be running number or sscc depending on where it came from + loadingUnitStatus: data.unitStatus, // TODO: add enums on the status of each load. + message: data.message, // the response it gave when scanning + }); + } catch (error) { + console.log("Error: ", error); + } +}; + const loadUnit = async (data: Data) => { // are we even active at this time? const dockDoorActive = await db.query.settings.findFirst({ where: (u, { eq }) => eq(u.name, "dockDoorScanning"), }); + const unitToScan = data.sscc + ? { sscc: data.sscc?.slice(2) } + : { runningNo: Number(data.runningNo) }; + + const dock = await db + .select() + .from(dockDoorScanners) + .where(eq(dockDoorScanners.dockId, data.dockId as string)); + if (!dockDoorActive?.active) { return returnFunc({ success: false, @@ -33,29 +57,18 @@ const loadUnit = async (data: Data) => { room: "", }); } - // check if its a valids an sscc - - if (data.sscc === "noread") { - return returnFunc({ - success: false, - level: "error", - module: "dockdoor", - subModule: "loadUnit", - message: - "Failed to load the unit to the truck, there was no pallet read.", - data: [], - notify: false, - room: `dockDoorLoading:${data.dockId}`, - }); - } // check if we currently have a loading order attached to the dock door. - const dock = await db - .select() - .from(dockDoorScanners) - .where(eq(dockDoorScanners.dockId, data.dockId as string)); if (dock[0]?.currentLoadingOrder === "") { + postScan({ + dockId: data.dockId, + loadingOrder: dock[0]?.currentLoadingOrder, + loadingUnit: unitToScan, + loadingUnitStatus: "notLoaded", + message: + "There are know current active loading orders please start one and try again.", + }); return returnFunc({ success: true, level: "error", @@ -68,6 +81,30 @@ const loadUnit = async (data: Data) => { room: `dockDoorLoading:${data.dockId}`, }); } + // check if its a valids an sscc + + if (data.sscc === "noread") { + postScan({ + dockId: data.dockId, + loadingOrder: dock[0]?.currentLoadingOrder, + loadingUnit: unitToScan, + loadingUnitStatus: "noread", + message: + "Failed to load the unit to the truck, there was no pallet read.", + }); + + return returnFunc({ + success: false, + level: "error", + module: "dockdoor", + subModule: "loadUnit", + message: + "Failed to load the unit to the truck, there was no pallet read.", + data: [], + notify: false, + room: `dockDoorLoading:${data.dockId}`, + }); + } // TODO: pallet validation, check if we are on hold, then check if we have been in the staging warehouse for more than x time. @@ -77,10 +114,6 @@ const loadUnit = async (data: Data) => { // add the loading units try { - const unitToScan = data.sscc - ? { sscc: data.sscc?.slice(2) } - : { runningNo: Number(data.runningNo) }; - const prod = (await runProdApi({ method: "post", endpoint: `/public/v1.0/OutboundDeliveries/LoadingOrders/${dock[0]?.currentLoadingOrder}/LoadUnit`, @@ -90,6 +123,13 @@ const loadUnit = async (data: Data) => { //emitToRoom(`dockDoorLoading:${data.dockId}`, prod?.data ?? []); if (!prod?.success) { + postScan({ + dockId: data.dockId, + loadingOrder: dock[0]?.currentLoadingOrder, + loadingUnit: unitToScan, + loadingUnitStatus: "notLoaded", + message: prod?.data.errors[0].message, + }); emitToRoom(`dockDoorLoading:${data.dockId}`, prod?.data.errors[0]); return returnFunc({ success: false, @@ -107,6 +147,14 @@ const loadUnit = async (data: Data) => { data: prod.data, code: 0, }; + + postScan({ + dockId: data.dockId, + loadingOrder: dock[0]?.currentLoadingOrder, + loadingUnit: unitToScan, + loadingUnitStatus: "loaded", + message: emitData.message, + }); emitToRoom(`dockDoorLoading:${data.dockId}`, emitData as any); return returnFunc({ success: true, diff --git a/backend/notification/notification.update.route.ts b/backend/notification/notification.update.route.ts index 91c0662..1130fb5 100644 --- a/backend/notification/notification.update.route.ts +++ b/backend/notification/notification.update.route.ts @@ -22,7 +22,6 @@ r.patch( requirePermission({ notifications: ["update"] }), async (req, res: Response) => { const { id } = req.params; - try { const validated = updateNote.parse(req.body); @@ -37,6 +36,7 @@ r.patch( await modifiedNotification(id as string); if (nError) { + return apiReturn(res, { success: false, level: "error", @@ -58,6 +58,7 @@ r.patch( status: 200, }); } catch (err) { + if (err instanceof z.ZodError) { const flattened = z.flattenError(err); // return res.status(400).json({ diff --git a/backend/socket.io/roomDefinitions.socket.ts b/backend/socket.io/roomDefinitions.socket.ts index f36f5d4..3af21ff 100644 --- a/backend/socket.io/roomDefinitions.socket.ts +++ b/backend/socket.io/roomDefinitions.socket.ts @@ -1,7 +1,8 @@ -import { desc } from "drizzle-orm"; +import { desc, eq } from "drizzle-orm"; import { db } from "../db/db.controller.js"; import { logs } from "../db/schema/logs.schema.js"; import { ppoRun } from "../warehousing/warehousing.ppooMonitor.js"; +import { dockDoorScans } from "../db/schema/dockdoor.scans.schema.js"; type RoomDefinition = { seed: (limit: number) => Promise; @@ -103,7 +104,18 @@ export const roomDefinition: Record = { "dockDoorLoading:2": { seed: async (limit) => { console.log(limit); - return []; + try { + const rows = await db + .select() + .from(dockDoorScans).where(eq(dockDoorScans.status, "active")) + .orderBy(desc(dockDoorScans.upd_date)) + .limit(limit); + + return rows; //.reverse(); + } catch (e) { + console.error("Failed to seed logs:", e); + return []; + } }, }, }; diff --git a/frontend/src/components/Sidebar/Warhouse.tsx b/frontend/src/components/Sidebar/Warhouse.tsx new file mode 100644 index 0000000..d12f74e --- /dev/null +++ b/frontend/src/components/Sidebar/Warhouse.tsx @@ -0,0 +1,94 @@ +import { useQuery } from "@tanstack/react-query"; +import { Link } from "@tanstack/react-router"; +import { ChevronRight, Link as link } from "lucide-react"; +import { permissionQuery } from "../../lib/queries/permsCheck"; +import { + Collapsible, + CollapsibleContent, + CollapsibleTrigger, +} from "../ui/collapsible"; +import { + SidebarGroup, + SidebarGroupContent, + SidebarGroupLabel, + SidebarMenu, + SidebarMenuButton, + SidebarMenuItem, + SidebarMenuSub, + SidebarMenuSubButton, + SidebarMenuSubItem, + useSidebar, +} from "../ui/sidebar"; + +export default function WarehouseBar() { + const { data: canCreate = false } = useQuery( + permissionQuery({ + warehouse: ["read"], + }), + ); + + const { setOpen } = useSidebar(); + const items = [ + { + title: "Dock Door Scanning", + url: "/warehouse", + //icon, + isActive: canCreate, + items: [ + { + title: "DockDoorScanning", + icon: link, + url: "/warehouse/dockdoorscanning", + }, + ], + }, + ]; + + return ( + + Warehouse + + + {items.map((item) => ( +
+ {item.isActive && ( + + + + + {item.title} + + + + + + + {item.items?.map((subItem) => ( + + + setOpen(false)} + > + + {subItem.title} + + + + ))} + + + + + )} +
+ ))} +
+
+
+ ); +} diff --git a/frontend/src/components/Sidebar/sidebar.tsx b/frontend/src/components/Sidebar/sidebar.tsx index 36b81da..b0f5483 100644 --- a/frontend/src/components/Sidebar/sidebar.tsx +++ b/frontend/src/components/Sidebar/sidebar.tsx @@ -13,16 +13,23 @@ import AdminSidebar from "./AdminBar"; import DocBar from "./DocBar"; import MobileBar from "./MobileBar"; import TransportationBar from "./TransportationBar"; +import WarehouseBar from "./Warhouse"; export function AppSidebar() { const { data: session } = useSession(); const { data: settings, isLoading } = useSuspenseQuery(getSettings()); - const { data: canRead = false } = useQuery( + const { data: canReadOpenDock = false } = useQuery( permissionQuery({ openDock: ["read"], }), ); + const { data: canReadWarehouse = false } = useQuery( + permissionQuery({ + warehouse: ["read"], + }), + ); + return ( n.name === "opendock_sync")[0] ?.active && - canRead && } + canReadOpenDock && } + + {!isLoading && + settings.filter((n: any) => n.name === "dockDoorScanning")[0] + ?.active && + canReadWarehouse && } {session && (session.user.role === "admin" || diff --git a/frontend/src/lib/queries/getActiveDockScanners.ts b/frontend/src/lib/queries/getActiveDockScanners.ts new file mode 100644 index 0000000..7689c6f --- /dev/null +++ b/frontend/src/lib/queries/getActiveDockScanners.ts @@ -0,0 +1,21 @@ +import { keepPreviousData, queryOptions } from "@tanstack/react-query"; +import { api } from "../apiHelper"; + +export function getActiveLoadingOrders() { + return queryOptions({ + queryKey: ["getActiveLoadingOrders"], + queryFn: () => dataFetch(), + staleTime: 5000, + refetchOnWindowFocus: true, + placeholderData: keepPreviousData, + }); +} + +const dataFetch = async () => { + const { data } = await api.get("/dockDoor/activeLoadingOrders"); + if (!data.success) { + throw new Error(data.message ?? "Failed to load articles"); + } + + return data.data ?? []; +}; diff --git a/frontend/src/lib/queries/getActiveLoadingOrders.ts b/frontend/src/lib/queries/getActiveLoadingOrders.ts new file mode 100644 index 0000000..0c3ccc1 --- /dev/null +++ b/frontend/src/lib/queries/getActiveLoadingOrders.ts @@ -0,0 +1,25 @@ +import { keepPreviousData, queryOptions } from "@tanstack/react-query"; +import { api } from "../apiHelper"; + +export function getActiveDockScanners() { + return queryOptions({ + queryKey: ["getActiveDockScanners"], + queryFn: () => dataFetch(), + staleTime: 5000, + refetchOnWindowFocus: true, + placeholderData: keepPreviousData, + }); +} + +const dataFetch = async () => { + if (window.location.hostname === "localhost") { + await new Promise((res) => setTimeout(res, 1500)); + } + + const { data } = await api.get("/dockDoor/scanners"); + if (!data.success) { + throw new Error(data.message ?? "Failed to load articles"); + } + + return data.data ?? []; +}; diff --git a/frontend/src/routeTree.gen.ts b/frontend/src/routeTree.gen.ts index 799f3c6..cd28b2b 100644 --- a/frontend/src/routeTree.gen.ts +++ b/frontend/src/routeTree.gen.ts @@ -22,7 +22,10 @@ import { Route as AdminScanUsersRouteImport } from './routes/admin/scanUsers' import { Route as AdminNotificationsRouteImport } from './routes/admin/notifications' import { Route as AdminLogsRouteImport } from './routes/admin/logs' import { Route as authLoginRouteImport } from './routes/(auth)/login' +import { Route as WarehouseDockdoorscanningIndexRouteImport } from './routes/warehouse/dockdoorscanning/index' import { Route as TransportationOpendockIndexRouteImport } from './routes/transportation/opendock/index' +import { Route as WarehouseDockdoorscanningDockScansRouteImport } from './routes/warehouse/dockdoorscanning/$dockScans' +import { Route as WarehouseDockdoorscanningDockRouteImport } from './routes/warehouse/dockdoorscanning/$dock' import { Route as authUserSignupRouteImport } from './routes/(auth)/user.signup' import { Route as authUserResetpasswordRouteImport } from './routes/(auth)/user.resetpassword' import { Route as authUserProfileRouteImport } from './routes/(auth)/user.profile' @@ -92,12 +95,30 @@ const authLoginRoute = authLoginRouteImport.update({ path: '/login', getParentRoute: () => rootRouteImport, } as any) +const WarehouseDockdoorscanningIndexRoute = + WarehouseDockdoorscanningIndexRouteImport.update({ + id: '/warehouse/dockdoorscanning/', + path: '/warehouse/dockdoorscanning/', + getParentRoute: () => rootRouteImport, + } as any) const TransportationOpendockIndexRoute = TransportationOpendockIndexRouteImport.update({ id: '/transportation/opendock/', path: '/transportation/opendock/', getParentRoute: () => rootRouteImport, } as any) +const WarehouseDockdoorscanningDockScansRoute = + WarehouseDockdoorscanningDockScansRouteImport.update({ + id: '/warehouse/dockdoorscanning/$dockScans', + path: '/warehouse/dockdoorscanning/$dockScans', + getParentRoute: () => rootRouteImport, + } as any) +const WarehouseDockdoorscanningDockRoute = + WarehouseDockdoorscanningDockRouteImport.update({ + id: '/warehouse/dockdoorscanning/$dock', + path: '/warehouse/dockdoorscanning/$dock', + getParentRoute: () => rootRouteImport, + } as any) const authUserSignupRoute = authUserSignupRouteImport.update({ id: '/(auth)/user/signup', path: '/user/signup', @@ -131,7 +152,10 @@ export interface FileRoutesByFullPath { '/user/profile': typeof authUserProfileRoute '/user/resetpassword': typeof authUserResetpasswordRoute '/user/signup': typeof authUserSignupRoute + '/warehouse/dockdoorscanning/$dock': typeof WarehouseDockdoorscanningDockRoute + '/warehouse/dockdoorscanning/$dockScans': typeof WarehouseDockdoorscanningDockScansRoute '/transportation/opendock/': typeof TransportationOpendockIndexRoute + '/warehouse/dockdoorscanning/': typeof WarehouseDockdoorscanningIndexRoute } export interface FileRoutesByTo { '/': typeof IndexRoute @@ -150,7 +174,10 @@ export interface FileRoutesByTo { '/user/profile': typeof authUserProfileRoute '/user/resetpassword': typeof authUserResetpasswordRoute '/user/signup': typeof authUserSignupRoute + '/warehouse/dockdoorscanning/$dock': typeof WarehouseDockdoorscanningDockRoute + '/warehouse/dockdoorscanning/$dockScans': typeof WarehouseDockdoorscanningDockScansRoute '/transportation/opendock': typeof TransportationOpendockIndexRoute + '/warehouse/dockdoorscanning': typeof WarehouseDockdoorscanningIndexRoute } export interface FileRoutesById { __root__: typeof rootRouteImport @@ -170,7 +197,10 @@ export interface FileRoutesById { '/(auth)/user/profile': typeof authUserProfileRoute '/(auth)/user/resetpassword': typeof authUserResetpasswordRoute '/(auth)/user/signup': typeof authUserSignupRoute + '/warehouse/dockdoorscanning/$dock': typeof WarehouseDockdoorscanningDockRoute + '/warehouse/dockdoorscanning/$dockScans': typeof WarehouseDockdoorscanningDockScansRoute '/transportation/opendock/': typeof TransportationOpendockIndexRoute + '/warehouse/dockdoorscanning/': typeof WarehouseDockdoorscanningIndexRoute } export interface FileRouteTypes { fileRoutesByFullPath: FileRoutesByFullPath @@ -191,7 +221,10 @@ export interface FileRouteTypes { | '/user/profile' | '/user/resetpassword' | '/user/signup' + | '/warehouse/dockdoorscanning/$dock' + | '/warehouse/dockdoorscanning/$dockScans' | '/transportation/opendock/' + | '/warehouse/dockdoorscanning/' fileRoutesByTo: FileRoutesByTo to: | '/' @@ -210,7 +243,10 @@ export interface FileRouteTypes { | '/user/profile' | '/user/resetpassword' | '/user/signup' + | '/warehouse/dockdoorscanning/$dock' + | '/warehouse/dockdoorscanning/$dockScans' | '/transportation/opendock' + | '/warehouse/dockdoorscanning' id: | '__root__' | '/' @@ -229,7 +265,10 @@ export interface FileRouteTypes { | '/(auth)/user/profile' | '/(auth)/user/resetpassword' | '/(auth)/user/signup' + | '/warehouse/dockdoorscanning/$dock' + | '/warehouse/dockdoorscanning/$dockScans' | '/transportation/opendock/' + | '/warehouse/dockdoorscanning/' fileRoutesById: FileRoutesById } export interface RootRouteChildren { @@ -249,7 +288,10 @@ export interface RootRouteChildren { authUserProfileRoute: typeof authUserProfileRoute authUserResetpasswordRoute: typeof authUserResetpasswordRoute authUserSignupRoute: typeof authUserSignupRoute + WarehouseDockdoorscanningDockRoute: typeof WarehouseDockdoorscanningDockRoute + WarehouseDockdoorscanningDockScansRoute: typeof WarehouseDockdoorscanningDockScansRoute TransportationOpendockIndexRoute: typeof TransportationOpendockIndexRoute + WarehouseDockdoorscanningIndexRoute: typeof WarehouseDockdoorscanningIndexRoute } declare module '@tanstack/react-router' { @@ -345,6 +387,13 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof authLoginRouteImport parentRoute: typeof rootRouteImport } + '/warehouse/dockdoorscanning/': { + id: '/warehouse/dockdoorscanning/' + path: '/warehouse/dockdoorscanning' + fullPath: '/warehouse/dockdoorscanning/' + preLoaderRoute: typeof WarehouseDockdoorscanningIndexRouteImport + parentRoute: typeof rootRouteImport + } '/transportation/opendock/': { id: '/transportation/opendock/' path: '/transportation/opendock' @@ -352,6 +401,20 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof TransportationOpendockIndexRouteImport parentRoute: typeof rootRouteImport } + '/warehouse/dockdoorscanning/$dockScans': { + id: '/warehouse/dockdoorscanning/$dockScans' + path: '/warehouse/dockdoorscanning/$dockScans' + fullPath: '/warehouse/dockdoorscanning/$dockScans' + preLoaderRoute: typeof WarehouseDockdoorscanningDockScansRouteImport + parentRoute: typeof rootRouteImport + } + '/warehouse/dockdoorscanning/$dock': { + id: '/warehouse/dockdoorscanning/$dock' + path: '/warehouse/dockdoorscanning/$dock' + fullPath: '/warehouse/dockdoorscanning/$dock' + preLoaderRoute: typeof WarehouseDockdoorscanningDockRouteImport + parentRoute: typeof rootRouteImport + } '/(auth)/user/signup': { id: '/(auth)/user/signup' path: '/user/signup' @@ -393,7 +456,11 @@ const rootRouteChildren: RootRouteChildren = { authUserProfileRoute: authUserProfileRoute, authUserResetpasswordRoute: authUserResetpasswordRoute, authUserSignupRoute: authUserSignupRoute, + WarehouseDockdoorscanningDockRoute: WarehouseDockdoorscanningDockRoute, + WarehouseDockdoorscanningDockScansRoute: + WarehouseDockdoorscanningDockScansRoute, TransportationOpendockIndexRoute: TransportationOpendockIndexRoute, + WarehouseDockdoorscanningIndexRoute: WarehouseDockdoorscanningIndexRoute, } export const routeTree = rootRouteImport ._addFileChildren(rootRouteChildren) diff --git a/frontend/src/routes/warehouse/dockdoorscanning/$dock.tsx b/frontend/src/routes/warehouse/dockdoorscanning/$dock.tsx new file mode 100644 index 0000000..321e393 --- /dev/null +++ b/frontend/src/routes/warehouse/dockdoorscanning/$dock.tsx @@ -0,0 +1,118 @@ +import { useSuspenseQuery } from "@tanstack/react-query"; +import { createFileRoute } from "@tanstack/react-router"; +import { format } from "date-fns"; +import { Button } from "../../../components/ui/button"; +import { + Card, + CardContent, + CardDescription, + CardFooter, + CardHeader, +} from "../../../components/ui/card"; +import { Separator } from "../../../components/ui/separator"; +import { getActiveLoadingOrders } from "../../../lib/queries/getActiveDockScanners"; +import { getActiveDockScanners } from "../../../lib/queries/getActiveLoadingOrders"; +import { finishLoadingOrder} from './index' +import { api } from "../../../lib/apiHelper"; +import { toast } from "sonner"; + +export const Route = createFileRoute("/warehouse/dockdoorscanning/$dock")({ + component: RouteComponent, +}); + +export const startOrder = async (loadingOrder: string, dockId: string, refetch:any, refetchActiveLoading:any) => { + + try { + const res = await api.post("/dockDoor/startLoad", { + "loadingOrder":String(loadingOrder), + "dockId":dockId +},{validateStatus: (status) => status < 500,}) + +if (!res.data.success) { + toast.error(res.data.message) + refetch() + refetchActiveLoading() + return +} +toast.success(res.data.message) +refetch() + refetchActiveLoading() + } catch (error) { + console.log(error) + toast.error(`Encountered error: ${JSON.stringify(error)}`) + } + +} + +function RouteComponent() { + const { dock } = Route.useParams(); + const { data, refetch } = useSuspenseQuery(getActiveDockScanners()); + const { data: loadingPlanItems, refetch: refetchActiveLoading } = useSuspenseQuery(getActiveLoadingOrders()); + + const dockData = data.filter((i: any) => i.dockId === dock); + const loadingPlans = loadingPlanItems.filter( + (l: any) => l.dockId === Number(dock), + ); + console.log(dockData[0].currentLoadingOrder === ""); + return ( +
+
+

Please select an active loading order for {dockData[0].name}

+
+
+ {loadingPlans && + loadingPlans.length > 0 && + loadingPlans.map((i: any) => { + return ( + + + Loading order ID: {i.id}{" "} +

+ Loading Date: {format(i.loadingDate, "MM/dd/yyyy HH:mm")} +

+
+ +

+ Below are the loading order details please validate the + loading order you are selecting before pressing start. +

+
+ {/* Mapping the items out so in case we have more than 1 it will display correctly */} + + {i?.loadingPlanItems?.map((l: any) => { + return ( +
+

Loading Sequence {l.loadingSequence}

+

+ Article: {l.articleId} - {l.articleDescription} +

+

+ Current loaded: {l.loadedQuantityLUs}/ + {l.plannedQuantityLUs} +

+ {l.remark !== "" &&

Remark: {l.remark}

} + + {i?.loadingPlanItems.length > 1 && ( + + )} +
+ ); + })} +
+ +
+ + + +
+
+
+ ); + })} +
+
+ ); +} diff --git a/frontend/src/routes/warehouse/dockdoorscanning/$dockScans.tsx b/frontend/src/routes/warehouse/dockdoorscanning/$dockScans.tsx new file mode 100644 index 0000000..671cbd4 --- /dev/null +++ b/frontend/src/routes/warehouse/dockdoorscanning/$dockScans.tsx @@ -0,0 +1,10 @@ +import { createFileRoute } from "@tanstack/react-router"; + +export const Route = createFileRoute("/warehouse/dockdoorscanning/$dockScans")({ + component: RouteComponent, +}); + +function RouteComponent() { + const { dockScans } = Route.useParams(); + return
Hello "/warehouse/dockdoorscanning/$docScans"! {dockScans}
; +} diff --git a/frontend/src/routes/warehouse/dockdoorscanning/index.tsx b/frontend/src/routes/warehouse/dockdoorscanning/index.tsx new file mode 100644 index 0000000..bcc7736 --- /dev/null +++ b/frontend/src/routes/warehouse/dockdoorscanning/index.tsx @@ -0,0 +1,120 @@ +import { useSuspenseQuery } from "@tanstack/react-query"; +import { createFileRoute, useNavigate } from "@tanstack/react-router"; +import { Card, CardContent, CardDescription, CardHeader } from "../../../components/ui/card"; +import { getActiveLoadingOrders } from "../../../lib/queries/getActiveDockScanners"; +import { getActiveDockScanners } from "../../../lib/queries/getActiveLoadingOrders"; +import { Button } from "../../../components/ui/button"; +import { api } from "../../../lib/apiHelper"; +import { toast } from "sonner"; + +export const Route = createFileRoute("/warehouse/dockdoorscanning/")({ + component: RouteComponent, +}); + +export const finishLoadingOrder = async (loadingOrder: string, dockId: string, refetch:any, refetchActiveLoading:any) => { + + try { + const res = await api.post("/dockDoor/finishOrder", { + "loadingOrder":loadingOrder, + "dockId":dockId +},{validateStatus: (status) => status < 500,}) + +if (!res.data.success) { + toast.error(res.data.message) + refetch() + refetchActiveLoading() + return +} +toast.info(res.data.message) +refetch() + refetchActiveLoading() + } catch (error) { + console.log(error) + toast.error(`Encountered error: ${JSON.stringify(error)}`) + } + +} + +function RouteComponent() { + const { data, isLoading, refetch } = useSuspenseQuery(getActiveDockScanners()); + const { data: loadingPlanItems, refetch : refetchActiveLoading } = useSuspenseQuery(getActiveLoadingOrders()); + const navigate = useNavigate(); + + if (isLoading) { + return ( +
+

Loading active dock scanners....

+
+ ); + } + return ( +
+
+

+ Select a dock you would like to work with +

+
+
+ {!isLoading && + data.length > 0 && + data.map((i: any) => { + const loadingPlan = + i.currentLoadingOrder !== "" + ? loadingPlanItems.filter( + (x: any) => x.id === Number(i.currentLoadingOrder), + ) + : []; + + + return ( + { + if (i.currentLoadingOrder === "") { + navigate({ + to: "/warehouse/dockdoorscanning/$dock", + params: { dock: i.dockId }, + search: { + name: i.name, + }, + }); + } + }} + > + {i.name} + For Abbott loads reminder: 3 lots per load max. + + {i.currentLoadingOrder !== "" ? ( + +
+ Current loading order: {i.currentLoadingOrder} +
+ +
+ + + {loadingPlan && loadingPlan.length !== 0 ? (<> + +

{`${loadingPlan[0].loadingPlanItems[0].articleId} - ${loadingPlan[0].loadingPlanItems[0].articleDescription}`}

+ +

Current Loaded :{" "} + {loadingPlan[0].loadingPlanItems[0].loadedQuantityLUs} /{" "} + {loadingPlan[0].loadingPlanItems[0].plannedQuantityLUs}

+ ): <>

The Current Loading order is invalid

+

It appears it could have been finished via another process

+
+
}
+
+ ) : ( + + No active loading orders please click me to select an order + + )} +
+ ); + })} +
+
+ ); +} diff --git a/migrations/0060_freezing_hercules.sql b/migrations/0060_freezing_hercules.sql new file mode 100644 index 0000000..dc5b2ec --- /dev/null +++ b/migrations/0060_freezing_hercules.sql @@ -0,0 +1,13 @@ +CREATE TABLE "dock_door_scans" ( + "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL, + "loading_order" text NOT NULL, + "loading_Unit" text, + "loading_unit_status" text DEFAULT 'loaded', + "message" text, + "status" text DEFAULT 'active', + "add_date" timestamp with time zone DEFAULT now(), + "add_user" text DEFAULT 'lst-system', + "upd_date" timestamp with time zone DEFAULT now(), + "upd_user" text DEFAULT 'lst-system', + CONSTRAINT "dock_door_scans_loading_Unit_unique" UNIQUE("loading_Unit") +); diff --git a/migrations/0061_wide_marrow.sql b/migrations/0061_wide_marrow.sql new file mode 100644 index 0000000..86e5ae7 --- /dev/null +++ b/migrations/0061_wide_marrow.sql @@ -0,0 +1 @@ +ALTER TABLE "dock_door_scans" ADD COLUMN "dock_id" text NOT NULL; \ No newline at end of file diff --git a/migrations/meta/0060_snapshot.json b/migrations/meta/0060_snapshot.json new file mode 100644 index 0000000..e07e50e --- /dev/null +++ b/migrations/meta/0060_snapshot.json @@ -0,0 +1,2691 @@ +{ + "id": "f3543601-6b78-4ccd-85f6-13d807be3e02", + "prevId": "652dcba7-d884-4408-95da-b5a9b6af82a6", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.alpla_purchase_history": { + "name": "alpla_purchase_history", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "apo": { + "name": "apo", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "revision": { + "name": "revision", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "confirmed": { + "name": "confirmed", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status_text": { + "name": "status_text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "journal_num": { + "name": "journal_num", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "add_date": { + "name": "add_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "add_user": { + "name": "add_user", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "upd_user": { + "name": "upd_user", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approved_status": { + "name": "approved_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'new'" + }, + "position": { + "name": "position", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.analytics": { + "name": "analytics", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "method": { + "name": "method", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "route_pattern": { + "name": "route_pattern", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "actual_path": { + "name": "actual_path", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status_code": { + "name": "status_code", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "duration_ms": { + "name": "duration_ms", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "module": { + "name": "module", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_email": { + "name": "user_email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.job_audit_log": { + "name": "job_audit_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "job_name": { + "name": "job_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "start_at": { + "name": "start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "finished_at": { + "name": "finished_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "duration_ms": { + "name": "duration_ms", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error_stack": { + "name": "error_stack", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "meta_data": { + "name": "meta_data", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": { + "idx_job_audit_logs_cleanup": { + "name": "idx_job_audit_logs_cleanup", + "columns": [ + { + "expression": "start_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.account": { + "name": "account", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "account_id": { + "name": "account_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "access_token_expires_at": { + "name": "access_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "refresh_token_expires_at": { + "name": "refresh_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "account_userId_idx": { + "name": "account_userId_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "account_user_id_user_id_fk": { + "name": "account_user_id_user_id_fk", + "tableFrom": "account", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.apikey": { + "name": "apikey", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "start": { + "name": "start", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "prefix": { + "name": "prefix", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "refill_interval": { + "name": "refill_interval", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "refill_amount": { + "name": "refill_amount", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "last_refill_at": { + "name": "last_refill_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "rate_limit_enabled": { + "name": "rate_limit_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "rate_limit_time_window": { + "name": "rate_limit_time_window", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 86400000 + }, + "rate_limit_max": { + "name": "rate_limit_max", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 10 + }, + "request_count": { + "name": "request_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "remaining": { + "name": "remaining", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "last_request": { + "name": "last_request", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "permissions": { + "name": "permissions", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "apikey_key_idx": { + "name": "apikey_key_idx", + "columns": [ + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "apikey_userId_idx": { + "name": "apikey_userId_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "apikey_user_id_user_id_fk": { + "name": "apikey_user_id_user_id_fk", + "tableFrom": "apikey", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.jwks": { + "name": "jwks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "public_key": { + "name": "public_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "private_key": { + "name": "private_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "impersonated_by": { + "name": "impersonated_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "session_userId_idx": { + "name": "session_userId_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "session_user_id_user_id_fk": { + "name": "session_user_id_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "session_token_unique": { + "name": "session_token_unique", + "nullsNotDistinct": false, + "columns": [ + "token" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email_verified": { + "name": "email_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "banned": { + "name": "banned", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "ban_reason": { + "name": "ban_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ban_expires": { + "name": "ban_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "display_username": { + "name": "display_username", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_email_unique": { + "name": "user_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + }, + "user_username_unique": { + "name": "user_username_unique", + "nullsNotDistinct": false, + "columns": [ + "username" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verification": { + "name": "verification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "verification_identifier_idx": { + "name": "verification_identifier_idx", + "columns": [ + { + "expression": "identifier", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.deployment_history": { + "name": "deployment_history", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "server_id": { + "name": "server_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "build_number": { + "name": "build_number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.analytics_daily": { + "name": "analytics_daily", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "business_date": { + "name": "business_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "method": { + "name": "method", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "route_pattern": { + "name": "route_pattern", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "module": { + "name": "module", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "total_hits": { + "name": "total_hits", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "unique_users": { + "name": "unique_users", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "success_count": { + "name": "success_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "error_count": { + "name": "error_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "avg_duration_ms": { + "name": "avg_duration_ms", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "max_duration_ms": { + "name": "max_duration_ms", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "first_hit_at": { + "name": "first_hit_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "last_hit_at": { + "name": "last_hit_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "analytics_daily_business_route_unique": { + "name": "analytics_daily_business_route_unique", + "nullsNotDistinct": false, + "columns": [ + "business_date", + "method", + "route_pattern", + "module" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.datamart": { + "name": "datamart", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "query": { + "name": "query", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "options": { + "name": "options", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "public_access": { + "name": "public_access", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "add_date": { + "name": "add_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "add_user": { + "name": "add_user", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'lst-system'" + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "upd_user": { + "name": "upd_user", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'lst-system'" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "datamart_name_unique": { + "name": "datamart_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dock_door_scans": { + "name": "dock_door_scans", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "loading_order": { + "name": "loading_order", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "loading_Unit": { + "name": "loading_Unit", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "loading_unit_status": { + "name": "loading_unit_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'loaded'" + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'active'" + }, + "add_date": { + "name": "add_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "add_user": { + "name": "add_user", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'lst-system'" + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "upd_user": { + "name": "upd_user", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'lst-system'" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "dock_door_scans_loading_Unit_unique": { + "name": "dock_door_scans_loading_Unit_unique", + "nullsNotDistinct": false, + "columns": [ + "loading_Unit" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dock_door_scanners": { + "name": "dock_door_scanners", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "ip": { + "name": "ip", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "dock_id": { + "name": "dock_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "current_loading_order": { + "name": "current_loading_order", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "add_date": { + "name": "add_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "add_user": { + "name": "add_user", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'lst-system'" + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "upd_user": { + "name": "upd_user", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'lst-system'" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "dock_door_scanners_name_unique": { + "name": "dock_door_scanners_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.inv_historical_data": { + "name": "inv_historical_data", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "hist_date": { + "name": "hist_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "plant_token": { + "name": "plant_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "article": { + "name": "article", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "article_description": { + "name": "article_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "material_type": { + "name": "material_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "total_QTY": { + "name": "total_QTY", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "available_QTY": { + "name": "available_QTY", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "coa_QTY": { + "name": "coa_QTY", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "held_QTY": { + "name": "held_QTY", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "consignment_qty": { + "name": "consignment_qty", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "lot_number": { + "name": "lot_number", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "location_id": { + "name": "location_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "whse_id": { + "name": "whse_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "whse_name": { + "name": "whse_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'missing whseName'" + }, + "upd_user": { + "name": "upd_user", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'lst-system'" + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.logs": { + "name": "logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "level": { + "name": "level", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "module": { + "name": "module", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "subModule": { + "name": "subModule", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "stack": { + "name": "stack", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "checked": { + "name": "checked", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "hostname": { + "name": "hostname", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.notifications": { + "name": "notifications", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "interval": { + "name": "interval", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'5'" + }, + "options": { + "name": "options", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + } + }, + "indexes": { + "notify_name": { + "name": "notify_name", + "columns": [ + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.notification_sub": { + "name": "notification_sub", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "notification_id": { + "name": "notification_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "emails": { + "name": "emails", + "type": "text[]", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + } + }, + "indexes": {}, + "foreignKeys": { + "notification_sub_user_id_user_id_fk": { + "name": "notification_sub_user_id_user_id_fk", + "tableFrom": "notification_sub", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "notification_sub_notification_id_notifications_id_fk": { + "name": "notification_sub_notification_id_notifications_id_fk", + "tableFrom": "notification_sub", + "tableTo": "notifications", + "columnsFrom": [ + "notification_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "notification_sub_user_notification_unique": { + "name": "notification_sub_user_notification_unique", + "nullsNotDistinct": false, + "columns": [ + "user_id", + "notification_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.opendock_apt": { + "name": "opendock_apt", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "release": { + "name": "release", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "open_dock_apt_id": { + "name": "open_dock_apt_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "appointment": { + "name": "appointment", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "opendock_apt_opendock_id_idx": { + "name": "opendock_apt_opendock_id_idx", + "columns": [ + { + "expression": "open_dock_apt_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "opendock_apt_release_unique": { + "name": "opendock_apt_release_unique", + "nullsNotDistinct": false, + "columns": [ + "release" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.opendock_article_setup": { + "name": "opendock_article_setup", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "av": { + "name": "av", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "customer": { + "name": "customer", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "customer_description": { + "name": "customer_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "load_type": { + "name": "load_type", + "type": "load_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'drop'" + }, + "dock": { + "name": "dock", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "upd_user": { + "name": "upd_user", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'lst-system'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "add_user": { + "name": "add_user", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'lst-system'" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uq_opendock_article_setup_av_customer": { + "name": "uq_opendock_article_setup_av_customer", + "nullsNotDistinct": false, + "columns": [ + "av", + "customer" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.opendock_dock_setup": { + "name": "opendock_dock_setup", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "dock_id": { + "name": "dock_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "upd_user": { + "name": "upd_user", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'lst-system'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "add_user": { + "name": "add_user", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'lst-system'" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.printer_log": { + "name": "printer_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "printer_log_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ip": { + "name": "ip", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "printer_sn": { + "name": "printer_sn", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "condition": { + "name": "condition", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.printer_data": { + "name": "printer_data", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "humanReadable_id": { + "name": "humanReadable_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "ipAddress": { + "name": "ipAddress", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "port": { + "name": "port", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "statusText": { + "name": "statusText", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "printer_sn": { + "name": "printer_sn", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_time_printed": { + "name": "last_time_printed", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "assigned": { + "name": "assigned", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "printDelay": { + "name": "printDelay", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 90 + }, + "processes": { + "name": "processes", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "print_delay_override": { + "name": "print_delay_override", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "add_Date": { + "name": "add_Date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": { + "printer_id": { + "name": "printer_id", + "columns": [ + { + "expression": "humanReadable_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "printer_data_humanReadable_id_unique": { + "name": "printer_data_humanReadable_id_unique", + "nullsNotDistinct": false, + "columns": [ + "humanReadable_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.scan_log": { + "name": "scan_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user": { + "name": "user", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "scanner_id": { + "name": "scanner_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "prompt": { + "name": "prompt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "command_description": { + "name": "command_description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "running_number": { + "name": "running_number", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "scanner_version": { + "name": "scanner_version", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "lines": { + "name": "lines", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "add_date": { + "name": "add_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.scan_users": { + "name": "scan_users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scanner_id": { + "name": "scanner_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "pin_number": { + "name": "pin_number", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "pin_hash": { + "name": "pin_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "excluded_commands": { + "name": "excluded_commands", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "role": { + "name": "role", + "type": "mobile_role", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'user'" + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "last_scan": { + "name": "last_scan", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "add_Date": { + "name": "add_Date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "scan_users_scanner_id_unique": { + "name": "scan_users_scanner_id_unique", + "nullsNotDistinct": false, + "columns": [ + "scanner_id" + ] + }, + "scan_users_pin_number_unique": { + "name": "scan_users_pin_number_unique", + "nullsNotDistinct": false, + "columns": [ + "pin_number" + ] + }, + "scan_user_unique": { + "name": "scan_user_unique", + "nullsNotDistinct": false, + "columns": [ + "scanner_id", + "pin_number" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.server_data": { + "name": "server_data", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "server": { + "name": "server", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "plant_token": { + "name": "plant_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "id_address": { + "name": "id_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "great_plains_plant_code": { + "name": "great_plains_plant_code", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "contact_email": { + "name": "contact_email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "server_loc": { + "name": "server_loc", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_updated": { + "name": "last_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "build_number": { + "name": "build_number", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_upgrading": { + "name": "is_upgrading", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "server_data_plant_token_unique": { + "name": "server_data_plant_token_unique", + "nullsNotDistinct": false, + "columns": [ + "plant_token" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.settings": { + "name": "settings", + "schema": "", + "columns": { + "settings_id": { + "name": "settings_id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "moduleName": { + "name": "moduleName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "roles": { + "name": "roles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[\"systemAdmin\"]'::jsonb" + }, + "settingType": { + "name": "settingType", + "type": "setting_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "seed_version": { + "name": "seed_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "add_User": { + "name": "add_User", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'LST_System'" + }, + "add_Date": { + "name": "add_Date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "upd_User": { + "name": "upd_User", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'LST_System'" + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": { + "settings_name_unique": { + "name": "settings_name_unique", + "columns": [ + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.app_stats": { + "name": "app_stats", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "default": "'primary'" + }, + "current_build": { + "name": "current_build", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "last_build_at": { + "name": "last_build_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "last_deploy_at": { + "name": "last_deploy_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "building": { + "name": "building", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updating": { + "name": "updating", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "last_updated": { + "name": "last_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "meta": { + "name": "meta", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'::jsonb" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.load_type": { + "name": "load_type", + "schema": "public", + "values": [ + "drop", + "live" + ] + }, + "public.mobile_role": { + "name": "mobile_role", + "schema": "public", + "values": [ + "user", + "lead", + "manager", + "admin" + ] + }, + "public.setting_type": { + "name": "setting_type", + "schema": "public", + "values": [ + "feature", + "system", + "standard" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/migrations/meta/0061_snapshot.json b/migrations/meta/0061_snapshot.json new file mode 100644 index 0000000..03e2f1d --- /dev/null +++ b/migrations/meta/0061_snapshot.json @@ -0,0 +1,2697 @@ +{ + "id": "c1c9697e-9296-4fb1-8bfe-a80ec8a45e54", + "prevId": "f3543601-6b78-4ccd-85f6-13d807be3e02", + "version": "7", + "dialect": "postgresql", + "tables": { + "public.alpla_purchase_history": { + "name": "alpla_purchase_history", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "apo": { + "name": "apo", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "revision": { + "name": "revision", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "confirmed": { + "name": "confirmed", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status_text": { + "name": "status_text", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "journal_num": { + "name": "journal_num", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "add_date": { + "name": "add_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "add_user": { + "name": "add_user", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "upd_user": { + "name": "upd_user", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "approved_status": { + "name": "approved_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'new'" + }, + "position": { + "name": "position", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.analytics": { + "name": "analytics", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "method": { + "name": "method", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "route_pattern": { + "name": "route_pattern", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "actual_path": { + "name": "actual_path", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "status_code": { + "name": "status_code", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "duration_ms": { + "name": "duration_ms", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "module": { + "name": "module", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_email": { + "name": "user_email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.job_audit_log": { + "name": "job_audit_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "job_name": { + "name": "job_name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "start_at": { + "name": "start_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "finished_at": { + "name": "finished_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "duration_ms": { + "name": "duration_ms", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error_message": { + "name": "error_message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "error_stack": { + "name": "error_stack", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "meta_data": { + "name": "meta_data", + "type": "jsonb", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": { + "idx_job_audit_logs_cleanup": { + "name": "idx_job_audit_logs_cleanup", + "columns": [ + { + "expression": "start_at", + "isExpression": false, + "asc": true, + "nulls": "last" + }, + { + "expression": "id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.account": { + "name": "account", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "account_id": { + "name": "account_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "provider_id": { + "name": "provider_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "access_token": { + "name": "access_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "refresh_token": { + "name": "refresh_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "id_token": { + "name": "id_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "access_token_expires_at": { + "name": "access_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "refresh_token_expires_at": { + "name": "refresh_token_expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "scope": { + "name": "scope", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "password": { + "name": "password", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + } + }, + "indexes": { + "account_userId_idx": { + "name": "account_userId_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "account_user_id_user_id_fk": { + "name": "account_user_id_user_id_fk", + "tableFrom": "account", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.apikey": { + "name": "apikey", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "start": { + "name": "start", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "prefix": { + "name": "prefix", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "key": { + "name": "key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "refill_interval": { + "name": "refill_interval", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "refill_amount": { + "name": "refill_amount", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "last_refill_at": { + "name": "last_refill_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "enabled": { + "name": "enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "rate_limit_enabled": { + "name": "rate_limit_enabled", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "rate_limit_time_window": { + "name": "rate_limit_time_window", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 86400000 + }, + "rate_limit_max": { + "name": "rate_limit_max", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 10 + }, + "request_count": { + "name": "request_count", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 0 + }, + "remaining": { + "name": "remaining", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "last_request": { + "name": "last_request", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "permissions": { + "name": "permissions", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "metadata": { + "name": "metadata", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "apikey_key_idx": { + "name": "apikey_key_idx", + "columns": [ + { + "expression": "key", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + }, + "apikey_userId_idx": { + "name": "apikey_userId_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "apikey_user_id_user_id_fk": { + "name": "apikey_user_id_user_id_fk", + "tableFrom": "apikey", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.jwks": { + "name": "jwks", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "public_key": { + "name": "public_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "private_key": { + "name": "private_key", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.session": { + "name": "session", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "token": { + "name": "token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "ip_address": { + "name": "ip_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_agent": { + "name": "user_agent", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "impersonated_by": { + "name": "impersonated_by", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": { + "session_userId_idx": { + "name": "session_userId_idx", + "columns": [ + { + "expression": "user_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": { + "session_user_id_user_id_fk": { + "name": "session_user_id_user_id_fk", + "tableFrom": "session", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "session_token_unique": { + "name": "session_token_unique", + "nullsNotDistinct": false, + "columns": [ + "token" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.user": { + "name": "user", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email": { + "name": "email", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "email_verified": { + "name": "email_verified", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "image": { + "name": "image", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "role": { + "name": "role", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "banned": { + "name": "banned", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "ban_reason": { + "name": "ban_reason", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ban_expires": { + "name": "ban_expires", + "type": "timestamp", + "primaryKey": false, + "notNull": false + }, + "username": { + "name": "username", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "display_username": { + "name": "display_username", + "type": "text", + "primaryKey": false, + "notNull": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "user_email_unique": { + "name": "user_email_unique", + "nullsNotDistinct": false, + "columns": [ + "email" + ] + }, + "user_username_unique": { + "name": "user_username_unique", + "nullsNotDistinct": false, + "columns": [ + "username" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.verification": { + "name": "verification", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true + }, + "identifier": { + "name": "identifier", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "expires_at": { + "name": "expires_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "verification_identifier_idx": { + "name": "verification_identifier_idx", + "columns": [ + { + "expression": "identifier", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.deployment_history": { + "name": "deployment_history", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "server_id": { + "name": "server_id", + "type": "uuid", + "primaryKey": false, + "notNull": false + }, + "build_number": { + "name": "build_number", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.analytics_daily": { + "name": "analytics_daily", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "business_date": { + "name": "business_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "method": { + "name": "method", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "route_pattern": { + "name": "route_pattern", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "module": { + "name": "module", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "total_hits": { + "name": "total_hits", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "unique_users": { + "name": "unique_users", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "success_count": { + "name": "success_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "error_count": { + "name": "error_count", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "avg_duration_ms": { + "name": "avg_duration_ms", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "max_duration_ms": { + "name": "max_duration_ms", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "first_hit_at": { + "name": "first_hit_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "last_hit_at": { + "name": "last_hit_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "updated_at": { + "name": "updated_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "analytics_daily_business_route_unique": { + "name": "analytics_daily_business_route_unique", + "nullsNotDistinct": false, + "columns": [ + "business_date", + "method", + "route_pattern", + "module" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.datamart": { + "name": "datamart", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "query": { + "name": "query", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "version": { + "name": "version", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "options": { + "name": "options", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "public_access": { + "name": "public_access", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "add_date": { + "name": "add_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "add_user": { + "name": "add_user", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'lst-system'" + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "upd_user": { + "name": "upd_user", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'lst-system'" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "datamart_name_unique": { + "name": "datamart_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dock_door_scans": { + "name": "dock_door_scans", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "dock_id": { + "name": "dock_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "loading_order": { + "name": "loading_order", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "loading_Unit": { + "name": "loading_Unit", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "loading_unit_status": { + "name": "loading_unit_status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'loaded'" + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'active'" + }, + "add_date": { + "name": "add_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "add_user": { + "name": "add_user", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'lst-system'" + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "upd_user": { + "name": "upd_user", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'lst-system'" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "dock_door_scans_loading_Unit_unique": { + "name": "dock_door_scans_loading_Unit_unique", + "nullsNotDistinct": false, + "columns": [ + "loading_Unit" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.dock_door_scanners": { + "name": "dock_door_scanners", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "ip": { + "name": "ip", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "dock_id": { + "name": "dock_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "current_loading_order": { + "name": "current_loading_order", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "add_date": { + "name": "add_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "add_user": { + "name": "add_user", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'lst-system'" + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "upd_user": { + "name": "upd_user", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'lst-system'" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "dock_door_scanners_name_unique": { + "name": "dock_door_scanners_name_unique", + "nullsNotDistinct": false, + "columns": [ + "name" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.inv_historical_data": { + "name": "inv_historical_data", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "hist_date": { + "name": "hist_date", + "type": "date", + "primaryKey": false, + "notNull": true + }, + "plant_token": { + "name": "plant_token", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "article": { + "name": "article", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "article_description": { + "name": "article_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "material_type": { + "name": "material_type", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "total_QTY": { + "name": "total_QTY", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "available_QTY": { + "name": "available_QTY", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "coa_QTY": { + "name": "coa_QTY", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "held_QTY": { + "name": "held_QTY", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "consignment_qty": { + "name": "consignment_qty", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "lot_number": { + "name": "lot_number", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "location_id": { + "name": "location_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "location": { + "name": "location", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "whse_id": { + "name": "whse_id", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "''" + }, + "whse_name": { + "name": "whse_name", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'missing whseName'" + }, + "upd_user": { + "name": "upd_user", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'lst-system'" + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.logs": { + "name": "logs", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "level": { + "name": "level", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "module": { + "name": "module", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "subModule": { + "name": "subModule", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "stack": { + "name": "stack", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "checked": { + "name": "checked", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "hostname": { + "name": "hostname", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.notifications": { + "name": "notifications", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "interval": { + "name": "interval", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'5'" + }, + "options": { + "name": "options", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + } + }, + "indexes": { + "notify_name": { + "name": "notify_name", + "columns": [ + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.notification_sub": { + "name": "notification_sub", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user_id": { + "name": "user_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "notification_id": { + "name": "notification_id", + "type": "uuid", + "primaryKey": false, + "notNull": true + }, + "emails": { + "name": "emails", + "type": "text[]", + "primaryKey": false, + "notNull": false, + "default": "'{}'" + } + }, + "indexes": {}, + "foreignKeys": { + "notification_sub_user_id_user_id_fk": { + "name": "notification_sub_user_id_user_id_fk", + "tableFrom": "notification_sub", + "tableTo": "user", + "columnsFrom": [ + "user_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + }, + "notification_sub_notification_id_notifications_id_fk": { + "name": "notification_sub_notification_id_notifications_id_fk", + "tableFrom": "notification_sub", + "tableTo": "notifications", + "columnsFrom": [ + "notification_id" + ], + "columnsTo": [ + "id" + ], + "onDelete": "cascade", + "onUpdate": "no action" + } + }, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "notification_sub_user_notification_unique": { + "name": "notification_sub_user_notification_unique", + "nullsNotDistinct": false, + "columns": [ + "user_id", + "notification_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.opendock_apt": { + "name": "opendock_apt", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "release": { + "name": "release", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "open_dock_apt_id": { + "name": "open_dock_apt_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "appointment": { + "name": "appointment", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[]'::jsonb" + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + } + }, + "indexes": { + "opendock_apt_opendock_id_idx": { + "name": "opendock_apt_opendock_id_idx", + "columns": [ + { + "expression": "open_dock_apt_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": false, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "opendock_apt_release_unique": { + "name": "opendock_apt_release_unique", + "nullsNotDistinct": false, + "columns": [ + "release" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.opendock_article_setup": { + "name": "opendock_article_setup", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "av": { + "name": "av", + "type": "integer", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "customer": { + "name": "customer", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "customer_description": { + "name": "customer_description", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "load_type": { + "name": "load_type", + "type": "load_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'drop'" + }, + "dock": { + "name": "dock", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "upd_user": { + "name": "upd_user", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'lst-system'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "add_user": { + "name": "add_user", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'lst-system'" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "uq_opendock_article_setup_av_customer": { + "name": "uq_opendock_article_setup_av_customer", + "nullsNotDistinct": false, + "columns": [ + "av", + "customer" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.opendock_dock_setup": { + "name": "opendock_dock_setup", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "dock_id": { + "name": "dock_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "upd_user": { + "name": "upd_user", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'lst-system'" + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "add_user": { + "name": "add_user", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'lst-system'" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.printer_log": { + "name": "printer_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "integer", + "primaryKey": true, + "notNull": true, + "identity": { + "type": "always", + "name": "printer_log_id_seq", + "schema": "public", + "increment": "1", + "startWith": "1", + "minValue": "1", + "maxValue": "2147483647", + "cache": "1", + "cycle": false + } + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "ip": { + "name": "ip", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "printer_sn": { + "name": "printer_sn", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "condition": { + "name": "condition", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "created_at": { + "name": "created_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.printer_data": { + "name": "printer_data", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "humanReadable_id": { + "name": "humanReadable_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "ipAddress": { + "name": "ipAddress", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "port": { + "name": "port", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "statusText": { + "name": "statusText", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "printer_sn": { + "name": "printer_sn", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_time_printed": { + "name": "last_time_printed", + "type": "timestamp", + "primaryKey": false, + "notNull": true, + "default": "now()" + }, + "assigned": { + "name": "assigned", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "remark": { + "name": "remark", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "printDelay": { + "name": "printDelay", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 90 + }, + "processes": { + "name": "processes", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "print_delay_override": { + "name": "print_delay_override", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + }, + "add_Date": { + "name": "add_Date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": { + "printer_id": { + "name": "printer_id", + "columns": [ + { + "expression": "humanReadable_id", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "printer_data_humanReadable_id_unique": { + "name": "printer_data_humanReadable_id_unique", + "nullsNotDistinct": false, + "columns": [ + "humanReadable_id" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.scan_log": { + "name": "scan_log", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "user": { + "name": "user", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "scanner_id": { + "name": "scanner_id", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "message": { + "name": "message", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "prompt": { + "name": "prompt", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "command_description": { + "name": "command_description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "running_number": { + "name": "running_number", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "scanner_version": { + "name": "scanner_version", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'0'" + }, + "lines": { + "name": "lines", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "add_date": { + "name": "add_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.scan_users": { + "name": "scan_users", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "scanner_id": { + "name": "scanner_id", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "pin_number": { + "name": "pin_number", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "pin_hash": { + "name": "pin_hash", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "excluded_commands": { + "name": "excluded_commands", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'[]'::jsonb" + }, + "role": { + "name": "role", + "type": "mobile_role", + "typeSchema": "public", + "primaryKey": false, + "notNull": true, + "default": "'user'" + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "last_scan": { + "name": "last_scan", + "type": "timestamp", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "add_Date": { + "name": "add_Date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "scan_users_scanner_id_unique": { + "name": "scan_users_scanner_id_unique", + "nullsNotDistinct": false, + "columns": [ + "scanner_id" + ] + }, + "scan_users_pin_number_unique": { + "name": "scan_users_pin_number_unique", + "nullsNotDistinct": false, + "columns": [ + "pin_number" + ] + }, + "scan_user_unique": { + "name": "scan_user_unique", + "nullsNotDistinct": false, + "columns": [ + "scanner_id", + "pin_number" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.server_data": { + "name": "server_data", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "server": { + "name": "server", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "plant_token": { + "name": "plant_token", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "id_address": { + "name": "id_address", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "great_plains_plant_code": { + "name": "great_plains_plant_code", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "contact_email": { + "name": "contact_email", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "contact_phone": { + "name": "contact_phone", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "server_loc": { + "name": "server_loc", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "last_updated": { + "name": "last_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "build_number": { + "name": "build_number", + "type": "integer", + "primaryKey": false, + "notNull": false + }, + "is_upgrading": { + "name": "is_upgrading", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": false + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": { + "server_data_plant_token_unique": { + "name": "server_data_plant_token_unique", + "nullsNotDistinct": false, + "columns": [ + "plant_token" + ] + } + }, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.settings": { + "name": "settings", + "schema": "", + "columns": { + "settings_id": { + "name": "settings_id", + "type": "uuid", + "primaryKey": true, + "notNull": true, + "default": "gen_random_uuid()" + }, + "name": { + "name": "name", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "value": { + "name": "value", + "type": "text", + "primaryKey": false, + "notNull": true + }, + "description": { + "name": "description", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "moduleName": { + "name": "moduleName", + "type": "text", + "primaryKey": false, + "notNull": false + }, + "active": { + "name": "active", + "type": "boolean", + "primaryKey": false, + "notNull": false, + "default": true + }, + "roles": { + "name": "roles", + "type": "jsonb", + "primaryKey": false, + "notNull": true, + "default": "'[\"systemAdmin\"]'::jsonb" + }, + "settingType": { + "name": "settingType", + "type": "setting_type", + "typeSchema": "public", + "primaryKey": false, + "notNull": false + }, + "seed_version": { + "name": "seed_version", + "type": "integer", + "primaryKey": false, + "notNull": false, + "default": 1 + }, + "add_User": { + "name": "add_User", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'LST_System'" + }, + "add_Date": { + "name": "add_Date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "upd_User": { + "name": "upd_User", + "type": "text", + "primaryKey": false, + "notNull": true, + "default": "'LST_System'" + }, + "upd_date": { + "name": "upd_date", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + } + }, + "indexes": { + "settings_name_unique": { + "name": "settings_name_unique", + "columns": [ + { + "expression": "name", + "isExpression": false, + "asc": true, + "nulls": "last" + } + ], + "isUnique": true, + "concurrently": false, + "method": "btree", + "with": {} + } + }, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + }, + "public.app_stats": { + "name": "app_stats", + "schema": "", + "columns": { + "id": { + "name": "id", + "type": "text", + "primaryKey": true, + "notNull": true, + "default": "'primary'" + }, + "current_build": { + "name": "current_build", + "type": "integer", + "primaryKey": false, + "notNull": true, + "default": 1 + }, + "last_build_at": { + "name": "last_build_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "last_deploy_at": { + "name": "last_deploy_at", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false + }, + "building": { + "name": "building", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "updating": { + "name": "updating", + "type": "boolean", + "primaryKey": false, + "notNull": true, + "default": false + }, + "last_updated": { + "name": "last_updated", + "type": "timestamp with time zone", + "primaryKey": false, + "notNull": false, + "default": "now()" + }, + "meta": { + "name": "meta", + "type": "jsonb", + "primaryKey": false, + "notNull": false, + "default": "'{}'::jsonb" + } + }, + "indexes": {}, + "foreignKeys": {}, + "compositePrimaryKeys": {}, + "uniqueConstraints": {}, + "policies": {}, + "checkConstraints": {}, + "isRLSEnabled": false + } + }, + "enums": { + "public.load_type": { + "name": "load_type", + "schema": "public", + "values": [ + "drop", + "live" + ] + }, + "public.mobile_role": { + "name": "mobile_role", + "schema": "public", + "values": [ + "user", + "lead", + "manager", + "admin" + ] + }, + "public.setting_type": { + "name": "setting_type", + "schema": "public", + "values": [ + "feature", + "system", + "standard" + ] + } + }, + "schemas": {}, + "sequences": {}, + "roles": {}, + "policies": {}, + "views": {}, + "_meta": { + "columns": {}, + "schemas": {}, + "tables": {} + } +} \ No newline at end of file diff --git a/migrations/meta/_journal.json b/migrations/meta/_journal.json index 6a48bc0..05423c7 100644 --- a/migrations/meta/_journal.json +++ b/migrations/meta/_journal.json @@ -421,6 +421,20 @@ "when": 1780349486711, "tag": "0059_sparkling_joystick", "breakpoints": true + }, + { + "idx": 60, + "version": "7", + "when": 1780584999699, + "tag": "0060_freezing_hercules", + "breakpoints": true + }, + { + "idx": 61, + "version": "7", + "when": 1780692629119, + "tag": "0061_wide_marrow", + "breakpoints": true } ] } \ No newline at end of file