From c0a7d4a1252e3f14240d14288a3ac4add44a6463 Mon Sep 17 00:00:00 2001 From: Blake Matthes Date: Tue, 9 Jun 2026 21:09:03 -0500 Subject: [PATCH] refactor(opendock): added some new goodies to the app to help manage releases --- backend/db/schema/opendock_apt.schema.ts | 1 + .../opendock/openDockRreleaseMonitor.utils.ts | 66 +- backend/opendock/openDockUndoLastStatus.ts | 73 + backend/opendock/opendock.routes.ts | 11 +- backend/opendock/opendockGetRelease.route.ts | 40 - backend/opendock/opendockRelease.route.ts | 124 + .../components/Sidebar/TransportationBar.tsx | 5 + frontend/src/lib/queries/openDockApt.ts | 23 + frontend/src/routeTree.gen.ts | 22 + .../transportation/opendock/releases.tsx | 221 ++ .../warehouse/dockdoorscanning/$dock.tsx | 7 +- .../dockdoorscanning/scans/$dockScans.tsx | 61 +- migrations/0063_illegal_mauler.sql | 1 + migrations/meta/0063_snapshot.json | 2696 +++++++++++++++++ migrations/meta/_journal.json | 7 + 15 files changed, 3286 insertions(+), 72 deletions(-) create mode 100644 backend/opendock/openDockUndoLastStatus.ts delete mode 100644 backend/opendock/opendockGetRelease.route.ts create mode 100644 backend/opendock/opendockRelease.route.ts create mode 100644 frontend/src/lib/queries/openDockApt.ts create mode 100644 frontend/src/routes/transportation/opendock/releases.tsx create mode 100644 migrations/0063_illegal_mauler.sql create mode 100644 migrations/meta/0063_snapshot.json diff --git a/backend/db/schema/opendock_apt.schema.ts b/backend/db/schema/opendock_apt.schema.ts index e6652dd..82bc9a4 100644 --- a/backend/db/schema/opendock_apt.schema.ts +++ b/backend/db/schema/opendock_apt.schema.ts @@ -16,6 +16,7 @@ export const opendockApt = pgTable( id: uuid("id").defaultRandom().primaryKey(), release: integer("release").notNull().unique("opendock_apt_release_unique"), openDockAptId: text("open_dock_apt_id").notNull(), + status: text("status").default("active"), appointment: jsonb("appointment").notNull().default([]), upd_date: timestamp("upd_date", { withTimezone: true }) .notNull() diff --git a/backend/opendock/openDockRreleaseMonitor.utils.ts b/backend/opendock/openDockRreleaseMonitor.utils.ts index f01a769..9c0b2df 100644 --- a/backend/opendock/openDockRreleaseMonitor.utils.ts +++ b/backend/opendock/openDockRreleaseMonitor.utils.ts @@ -21,6 +21,7 @@ type Releases = { ReleaseNumber: number; DeliveryState: number; DeliveryDate: Date; + ReleaseState: number; LineItemHumanReadableId: number; ArticleAlias: string; LoadingUnits: string; @@ -38,6 +39,8 @@ const actaulDocks = [ { name: "matrix", dockId: "3e32cbfc-49f4-4138-b491-9d5df9c94754" }, { name: "gerber", dockId: "9109e789-6c15-4cd9-87cb-de1b18627b6d" }, { name: "rb", dockId: "6be02526-6183-4789-a73f-e0aa155e6d1e" }, + //test server dock + { name: "second", dockId: "e87c92bd-13b4-4f7e-bf5e-b0182884c47a" }, ]; const timeZone = process.env.TIMEZONE as string; const TWENTY_FOUR_HOURS = 24 * 60 * 60 * 1000; @@ -273,11 +276,65 @@ const postRelease = async (release: Releases) => { if (existing) { const id = existing.openDockAptId; + // deal with canceled stuff as we want this gone off od + if (release.ReleaseState === 2 || release.ReleaseState === 4) { + // delete the order in od and change the state to canceled in lst + try { + const response = await axios.delete( + `${process.env.OPENDOCK_URL}/appointment/${id}`, + { + headers: { + "content-type": "application/json; charset=utf-8", + Authorization: `Bearer ${odToken.odToken}`, + }, + }, + // { + // hardDelete: true, + // }, + ); + + if (response.status === 400) { + log.error({}, response.data.data.message); + return; + } + + // update the release in the db leaving as insert just incase something weird happened + try { + await db + .update(opendockApt) + .set({ + status: "canceled", + upd_date: sql`Now()`, + }) + .where(eq(opendockApt.release, release.ReleaseNumber)) + .returning(); + + log.info({}, `${release.ReleaseNumber} was canceled`); + } catch (e) { + log.error( + { stack: e }, + `Error canceling the release: ${release.ReleaseNumber}`, + ); + } + // biome-ignore lint/suspicious/noExplicitAny: to many possibilities + } catch (e: any) { + //console.info(newDockApt); + log.error( + { stack: e.response.data }, + `An error has occurred during canceling of the release: ${release.ReleaseNumber}`, + ); + + return; + } + + return; + } + if ( (releaseLoadtypeCheck || opendDockArticleCheck?.loadType === "drop" || defaultDock?.value === "drop") && - (release.DeliveryState === 0 || release.DeliveryState === 2) + release.DeliveryState === 2 ) { const setArrival = { ...newDockApt, status: "Arrived" }; @@ -392,7 +449,11 @@ const postRelease = async (release: Releases) => { return; } // changing to only trigger the change if the state is 2 meaning it has a scan to it and already in progress of being loaded. - } else if (release.DeliveryState === 0 || release.DeliveryState === 2) { + } else if ( + release.DeliveryState === 0 || + release.DeliveryState === 1 || + release.DeliveryState === 2 + ) { try { const response = await axios.patch( `${process.env.OPENDOCK_URL}/appointment/${id}`, @@ -479,6 +540,7 @@ const postRelease = async (release: Releases) => { set: { openDockAptId: response.data.data.id, appointment: response.data.data, + status: "completed", upd_date: sql`NOW()`, }, }) diff --git a/backend/opendock/openDockUndoLastStatus.ts b/backend/opendock/openDockUndoLastStatus.ts new file mode 100644 index 0000000..f785d03 --- /dev/null +++ b/backend/opendock/openDockUndoLastStatus.ts @@ -0,0 +1,73 @@ +import axios from "axios"; +import { eq, sql } from "drizzle-orm"; +import { Router } from "express"; +import { db } from "../db/db.controller.js"; +import { opendockApt } from "../db/schema/opendock_apt.schema.js"; +import { apiReturn } from "../utils/returnHelper.utils.js"; +import { tryCatch } from "../utils/trycatch.utils.js"; +import { odToken } from "./opendock.utils.js"; + +const r = Router(); + +r.patch("/:id", async (req, res) => { + //const limit + const { id } = req.params; + + try { + const response = await axios.patch( + `${process.env.OPENDOCK_URL}/appointment/${id}/undo-latest-status`, + { + headers: { + "content-type": "application/json; charset=utf-8", + Authorization: `Bearer ${odToken.odToken}`, + }, + }, + ); + + if (response.status === 400) { + return apiReturn(res, { + success: false, + level: "error", + module: "opendock", + subModule: "apt", + message: response.data.data.message, + data: [], + status: 400, + }); + } + + // update the release in the db + const { data } = await tryCatch( + db + .update(opendockApt) + .set({ + appointment: response.data.data, + upd_date: sql`NOW()`, + }) + .where(eq(opendockApt.openDockAptId, id)), + ); + + return apiReturn(res, { + success: true, + level: "info", + module: "opendock", + subModule: "apt", + message: `The release was reverted to the last state.`, + data: data as any, + status: 200, + }); + // biome-ignore lint/suspicious/noExplicitAny: to many possibilities + } catch (e: any) { + return apiReturn(res, { + success: false, + level: "error", + module: "opendock", + subModule: "apt", + message: `An error updating the release in opendock`, + data: e.response.data, + status: 400, + }); + } +}); + +export default r; diff --git a/backend/opendock/opendock.routes.ts b/backend/opendock/opendock.routes.ts index d8865c3..d285912 100644 --- a/backend/opendock/opendock.routes.ts +++ b/backend/opendock/opendock.routes.ts @@ -1,9 +1,9 @@ import type { Express } from "express"; import { requireAuth } from "../middleware/auth.middleware.js"; import { featureCheck } from "../middleware/featureActive.middleware.js"; +import undo from "./openDockUndoLastStatus.js"; import articleCheck from "./opendock.articleCheck.route.js"; - -import getApt from "./opendockGetRelease.route.js"; +import getApt from "./opendockRelease.route.js"; export const setupOpendockRoutes = (baseUrl: string, app: Express) => { //setup all the routes @@ -21,4 +21,11 @@ export const setupOpendockRoutes = (baseUrl: string, app: Express) => { requireAuth, articleCheck, ); + + app.use( + `${baseUrl}/api/opendock/undo-latest-status`, + featureCheck("opendock_sync"), + requireAuth, + undo, + ); }; diff --git a/backend/opendock/opendockGetRelease.route.ts b/backend/opendock/opendockGetRelease.route.ts deleted file mode 100644 index cdf2425..0000000 --- a/backend/opendock/opendockGetRelease.route.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { desc, gte, sql } from "drizzle-orm"; -import { Router } from "express"; -import { db } from "../db/db.controller.js"; -import { opendockApt } from "../db/schema/opendock_apt.schema.js"; -import { apiReturn } from "../utils/returnHelper.utils.js"; -import { tryCatch } from "../utils/trycatch.utils.js"; - -const r = Router(); - -r.get("/", async (_, res) => { - //const limit - - const daysCreated = 30; - - const { data } = await tryCatch( - db - .select() - .from(opendockApt) - .where( - gte( - opendockApt.createdAt, - sql.raw(`NOW() - INTERVAL '${daysCreated} days'`), - ), - ) - .orderBy(desc(opendockApt.createdAt)) - .limit(500), - ); - - apiReturn(res, { - success: true, - level: "info", - module: "opendock", - subModule: "apt", - message: `The first ${data?.length} Apt(s) that were created in the last ${daysCreated} `, - data: data ?? [], - status: 200, - }); -}); - -export default r; diff --git a/backend/opendock/opendockRelease.route.ts b/backend/opendock/opendockRelease.route.ts new file mode 100644 index 0000000..fda0cd7 --- /dev/null +++ b/backend/opendock/opendockRelease.route.ts @@ -0,0 +1,124 @@ +import axios from "axios"; +import { and, desc, eq, gte, sql } from "drizzle-orm"; +import { Router } from "express"; +import { db } from "../db/db.controller.js"; +import { opendockApt } from "../db/schema/opendock_apt.schema.js"; +import { apiReturn } from "../utils/returnHelper.utils.js"; +import { tryCatch } from "../utils/trycatch.utils.js"; +import { odToken } from "./opendock.utils.js"; + +const r = Router(); + +r.get("/", async (req, res) => { + //const limit + + const daysCreated = req.query.daysCreated ?? 30; + + const { data } = await tryCatch( + db + .select() + .from(opendockApt) + .where( + and( + gte( + opendockApt.upd_date, + sql.raw(`NOW() - INTERVAL '${daysCreated} days'`), + ), + eq(opendockApt.status, "active"), + ), + ) + .orderBy(desc(opendockApt.upd_date)) + .limit(500), + ); + + apiReturn(res, { + success: true, + level: "info", + module: "opendock", + subModule: "apt", + message: `The first ${data?.length} Apt(s) that were created in the last ${daysCreated} `, + data: data ?? [], + status: 200, + }); +}); + +r.delete("/:id", async (req, res) => { + const { id } = req.params; + + const { data: releaseInfo } = (await tryCatch( + db + .select() + .from(opendockApt) + .where(eq(opendockApt.id, id as string)), + )) as any; + + if (releaseInfo.length === 0) { + return apiReturn(res, { + success: false, + level: "error", + module: "opendock", + subModule: "apt", + message: "Invalid release id passed over please try again", + data: [], + status: 400, + }); + } + + try { + const response = await axios.delete( + `${process.env.OPENDOCK_URL}/appointment/${releaseInfo[0].appointment.id}`, + { + headers: { + "content-type": "application/json; charset=utf-8", + Authorization: `Bearer ${odToken.odToken}`, + }, + }, + // { + // hardDelete: true, + // }, + ); + + if (response.status === 400) { + return apiReturn(res, { + success: false, + level: "error", + module: "opendock", + subModule: "apt", + message: response.data.data.message, + data: [], + status: 400, + }); + } + + // update the release in the db leaving as insert just in-case something weird happened + const { data } = await tryCatch( + db + .delete(opendockApt) + .where(eq(opendockApt.id, id as string)) + .returning(), + ); + + return apiReturn(res, { + success: true, + level: "info", + module: "opendock", + subModule: "apt", + message: `The release was deleted, this is un unrecoverable`, + data: data as any, + status: 200, + }); + // biome-ignore lint/suspicious/noExplicitAny: to many possibilities + } catch (e: any) { + return apiReturn(res, { + success: false, + level: "error", + module: "opendock", + subModule: "apt", + message: `An error deleting the release in opendock`, + data: e.response.data, + status: 400, + }); + } +}); + +export default r; diff --git a/frontend/src/components/Sidebar/TransportationBar.tsx b/frontend/src/components/Sidebar/TransportationBar.tsx index adee9f5..cd07aa6 100644 --- a/frontend/src/components/Sidebar/TransportationBar.tsx +++ b/frontend/src/components/Sidebar/TransportationBar.tsx @@ -40,6 +40,11 @@ export default function TransportationBar() { icon: link, url: "/transportation/opendock", }, + { + title: "Active releases", + icon: link, + url: "/transportation/opendock/releases", + }, ], }, ]; diff --git a/frontend/src/lib/queries/openDockApt.ts b/frontend/src/lib/queries/openDockApt.ts new file mode 100644 index 0000000..6c86198 --- /dev/null +++ b/frontend/src/lib/queries/openDockApt.ts @@ -0,0 +1,23 @@ +import { keepPreviousData, queryOptions } from "@tanstack/react-query"; + +import { api } from "../apiHelper"; + +export function opendockApt() { + return queryOptions({ + queryKey: ["opendockApt"], + queryFn: () => fetch(), + staleTime: 5000, + refetchOnWindowFocus: true, + placeholderData: keepPreviousData, + }); +} + +const fetch = async () => { + if (window.location.hostname === "localhost") { + await new Promise((res) => setTimeout(res, 1500)); + } + + const { data } = await api.get("/opendock?daysCreated=90"); + + return data.data; +}; diff --git a/frontend/src/routeTree.gen.ts b/frontend/src/routeTree.gen.ts index 8940f7c..175d0a6 100644 --- a/frontend/src/routeTree.gen.ts +++ b/frontend/src/routeTree.gen.ts @@ -25,6 +25,7 @@ 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 WarehouseDockdoorscanningDockRouteImport } from './routes/warehouse/dockdoorscanning/$dock' +import { Route as TransportationOpendockReleasesRouteImport } from './routes/transportation/opendock/releases' 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' @@ -113,6 +114,12 @@ const WarehouseDockdoorscanningDockRoute = path: '/warehouse/dockdoorscanning/$dock', getParentRoute: () => rootRouteImport, } as any) +const TransportationOpendockReleasesRoute = + TransportationOpendockReleasesRouteImport.update({ + id: '/transportation/opendock/releases', + path: '/transportation/opendock/releases', + getParentRoute: () => rootRouteImport, + } as any) const authUserSignupRoute = authUserSignupRouteImport.update({ id: '/(auth)/user/signup', path: '/user/signup', @@ -152,6 +159,7 @@ export interface FileRoutesByFullPath { '/user/profile': typeof authUserProfileRoute '/user/resetpassword': typeof authUserResetpasswordRoute '/user/signup': typeof authUserSignupRoute + '/transportation/opendock/releases': typeof TransportationOpendockReleasesRoute '/warehouse/dockdoorscanning/$dock': typeof WarehouseDockdoorscanningDockRoute '/transportation/opendock/': typeof TransportationOpendockIndexRoute '/warehouse/dockdoorscanning/': typeof WarehouseDockdoorscanningIndexRoute @@ -174,6 +182,7 @@ export interface FileRoutesByTo { '/user/profile': typeof authUserProfileRoute '/user/resetpassword': typeof authUserResetpasswordRoute '/user/signup': typeof authUserSignupRoute + '/transportation/opendock/releases': typeof TransportationOpendockReleasesRoute '/warehouse/dockdoorscanning/$dock': typeof WarehouseDockdoorscanningDockRoute '/transportation/opendock': typeof TransportationOpendockIndexRoute '/warehouse/dockdoorscanning': typeof WarehouseDockdoorscanningIndexRoute @@ -197,6 +206,7 @@ export interface FileRoutesById { '/(auth)/user/profile': typeof authUserProfileRoute '/(auth)/user/resetpassword': typeof authUserResetpasswordRoute '/(auth)/user/signup': typeof authUserSignupRoute + '/transportation/opendock/releases': typeof TransportationOpendockReleasesRoute '/warehouse/dockdoorscanning/$dock': typeof WarehouseDockdoorscanningDockRoute '/transportation/opendock/': typeof TransportationOpendockIndexRoute '/warehouse/dockdoorscanning/': typeof WarehouseDockdoorscanningIndexRoute @@ -221,6 +231,7 @@ export interface FileRouteTypes { | '/user/profile' | '/user/resetpassword' | '/user/signup' + | '/transportation/opendock/releases' | '/warehouse/dockdoorscanning/$dock' | '/transportation/opendock/' | '/warehouse/dockdoorscanning/' @@ -243,6 +254,7 @@ export interface FileRouteTypes { | '/user/profile' | '/user/resetpassword' | '/user/signup' + | '/transportation/opendock/releases' | '/warehouse/dockdoorscanning/$dock' | '/transportation/opendock' | '/warehouse/dockdoorscanning' @@ -265,6 +277,7 @@ export interface FileRouteTypes { | '/(auth)/user/profile' | '/(auth)/user/resetpassword' | '/(auth)/user/signup' + | '/transportation/opendock/releases' | '/warehouse/dockdoorscanning/$dock' | '/transportation/opendock/' | '/warehouse/dockdoorscanning/' @@ -288,6 +301,7 @@ export interface RootRouteChildren { authUserProfileRoute: typeof authUserProfileRoute authUserResetpasswordRoute: typeof authUserResetpasswordRoute authUserSignupRoute: typeof authUserSignupRoute + TransportationOpendockReleasesRoute: typeof TransportationOpendockReleasesRoute WarehouseDockdoorscanningDockRoute: typeof WarehouseDockdoorscanningDockRoute TransportationOpendockIndexRoute: typeof TransportationOpendockIndexRoute WarehouseDockdoorscanningIndexRoute: typeof WarehouseDockdoorscanningIndexRoute @@ -408,6 +422,13 @@ declare module '@tanstack/react-router' { preLoaderRoute: typeof WarehouseDockdoorscanningDockRouteImport parentRoute: typeof rootRouteImport } + '/transportation/opendock/releases': { + id: '/transportation/opendock/releases' + path: '/transportation/opendock/releases' + fullPath: '/transportation/opendock/releases' + preLoaderRoute: typeof TransportationOpendockReleasesRouteImport + parentRoute: typeof rootRouteImport + } '/(auth)/user/signup': { id: '/(auth)/user/signup' path: '/user/signup' @@ -456,6 +477,7 @@ const rootRouteChildren: RootRouteChildren = { authUserProfileRoute: authUserProfileRoute, authUserResetpasswordRoute: authUserResetpasswordRoute, authUserSignupRoute: authUserSignupRoute, + TransportationOpendockReleasesRoute: TransportationOpendockReleasesRoute, WarehouseDockdoorscanningDockRoute: WarehouseDockdoorscanningDockRoute, TransportationOpendockIndexRoute: TransportationOpendockIndexRoute, WarehouseDockdoorscanningIndexRoute: WarehouseDockdoorscanningIndexRoute, diff --git a/frontend/src/routes/transportation/opendock/releases.tsx b/frontend/src/routes/transportation/opendock/releases.tsx new file mode 100644 index 0000000..2bd527f --- /dev/null +++ b/frontend/src/routes/transportation/opendock/releases.tsx @@ -0,0 +1,221 @@ +import { useQuery, useSuspenseQuery } from "@tanstack/react-query"; +import { createFileRoute, redirect } from "@tanstack/react-router"; +import { createColumnHelper } from "@tanstack/react-table"; +import { formatInTimeZone } from "date-fns-tz"; +import { Trash } from "lucide-react"; +import { Suspense, useState } from "react"; +import { toast } from "sonner"; +import { Button } from "../../../components/ui/button"; +import { Spinner } from "../../../components/ui/spinner"; +import { api } from "../../../lib/apiHelper"; +import { authClient } from "../../../lib/auth-client"; +import { opendockApt } from "../../../lib/queries/openDockApt"; +import { permissionQuery } from "../../../lib/queries/permsCheck"; +import LstTable from "../../../lib/tableStuff/LstTable"; +import SearchableHeader from "../../../lib/tableStuff/SearchableHeader"; +import SkellyTable from "../../../lib/tableStuff/SkellyTable"; + +export const Route = createFileRoute("/transportation/opendock/releases")({ + beforeLoad: async ({ location }) => { + const { data: session } = await authClient.getSession(); + //const allowedRole = ["systemAdmin", "admin", "manager"]; + + const canAccess = await authClient.admin.hasPermission({ + permissions: { + openDock: ["create"], + }, + }); + + if (!session?.user) { + throw redirect({ + to: "/", + search: { + redirect: location.href, + }, + }); + } + + //if (!allowedRole.includes(session.user.role as string)) { + + if (!canAccess) { + throw redirect({ + to: "/", + }); + } + + return { user: session.user }; + }, + component: RouteComponent, +}); + +const OpendockApts = () => { + const { data, refetch } = useSuspenseQuery(opendockApt()); + const { data: canReadOpenDock = false } = useQuery( + permissionQuery({ + openDock: ["update"], + }), + ); + + const columnHelper = createColumnHelper(); + + const columns = [ + columnHelper.accessor("release", { + header: ({ column }) => ( + + ), + filterFn: "includesString", + cell: (i) => i.getValue(), + }), + columnHelper.accessor( + (row) => + row.appointment.customFields.find((x: any) => x.name === "strArticle") + ?.value ?? "", + { + id: "article", + header: ({ column }) => ( + + ), + filterFn: "includesString", + cell: (i) => i.getValue(), + }, + ), + columnHelper.accessor("appointment.status", { + header: ({ column }) => ( + + ), + filterFn: "includesString", + cell: (i) => i.getValue(), + }), + columnHelper.accessor("upd_date", { + header: ({ column }) => ( + + ), + filterFn: "includesString", + cell: (i) => { + function isDateValid(date: any) { + return date instanceof Date && !isNaN(date.getTime()); + } + + const trueDate = isDateValid(new Date(i.getValue())) + ? formatInTimeZone( + i.getValue(), + `${window.LST_CONFIG?.timezone}`, + "MM/dd/yyyy HH:mm:ss", + ) + : "invalid time"; + + return {trueDate}; + }, + }), + ]; + + if (canReadOpenDock) { + columns.push( + columnHelper.accessor("deleteRelease", { + header: ({ column }) => ( + + ), + filterFn: "includesString", + cell: (i) => { + // biome-ignore lint: just removing the lint for now to get this going will maybe fix later + const [activeToggle, setActiveToggle] = useState(false); + + const onTrigger = async () => { + setActiveToggle(true); + + try { + const res = await api.delete( + `/opendock/${i.row.original.id}`, + + { + withCredentials: true, + timeout: 5000, + validateStatus: () => true, + }, + ); + + if (res.data.success) { + toast.success( + `Release: ${i.row.original.release} was deleted.`, + ); + refetch(); + setActiveToggle(false); + } + + if (!res.data.success) { + toast.error( + `Release: ${i.row.original.release} encountered an error when trying to delete: ${res.data.message}`, + ); + refetch(); + setActiveToggle(false); + } + } catch (error) { + setActiveToggle(false); + console.error(error); + } + }; + + return ( +
+
+ +
+
+ ); + }, + }), + ); + } + return ( +
+
+
+ {/* +

Loading...

+
+ } + > + + */} +
+
+ +
+
+ + ); +}; +function RouteComponent() { + return ( + }> + + + ); +} diff --git a/frontend/src/routes/warehouse/dockdoorscanning/$dock.tsx b/frontend/src/routes/warehouse/dockdoorscanning/$dock.tsx index f4c3020..8569e8a 100644 --- a/frontend/src/routes/warehouse/dockdoorscanning/$dock.tsx +++ b/frontend/src/routes/warehouse/dockdoorscanning/$dock.tsx @@ -68,9 +68,9 @@ function RouteComponent() {

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

-
+
{loadingPlans && loadingPlans.length > 0 ? ( -
+
{loadingPlans.map((i: any) => { return ( @@ -140,7 +140,8 @@ function RouteComponent() { ) } disabled={ - dockData[0].currentLoadingOrder === "" ? true : false + dockData[0].currentLoadingOrder === "" || + dockData[0].currentLoadingOrder !== i.id.toString() } > Finish Loading diff --git a/frontend/src/routes/warehouse/dockdoorscanning/scans/$dockScans.tsx b/frontend/src/routes/warehouse/dockdoorscanning/scans/$dockScans.tsx index 16c1a1d..38d671a 100644 --- a/frontend/src/routes/warehouse/dockdoorscanning/scans/$dockScans.tsx +++ b/frontend/src/routes/warehouse/dockdoorscanning/scans/$dockScans.tsx @@ -1,4 +1,4 @@ -import { useSuspenseQuery } from "@tanstack/react-query"; +import { useQuery, useSuspenseQuery } from "@tanstack/react-query"; import { createFileRoute } from "@tanstack/react-router"; import { createColumnHelper } from "@tanstack/react-table"; import { formatInTimeZone } from "date-fns-tz"; @@ -9,6 +9,7 @@ import { api } from "../../../../lib/apiHelper"; import { useAppForm } from "../../../../lib/formSutff"; import { getActiveLoadingOrders } from "../../../../lib/queries/getActiveDockScanners"; import { getActiveDockScanners } from "../../../../lib/queries/getActiveLoadingOrders"; +import { permissionQuery } from "../../../../lib/queries/permsCheck"; import LstTable from "../../../../lib/tableStuff/LstTable"; import SearchableHeader from "../../../../lib/tableStuff/SearchableHeader"; import { finishLoadingOrder } from ".."; @@ -27,6 +28,12 @@ function RouteComponent() { const { data, refetch } = useSuspenseQuery(getActiveDockScanners()); const { data: loadingPlanItems, refetch: refetchActiveLoading } = useSuspenseQuery(getActiveLoadingOrders()); + + const { data: canReadWarehouse = false } = useQuery( + permissionQuery({ + warehouse: ["delete"], + }), + ); const columnHelper = createColumnHelper(); const column = [ @@ -119,6 +126,7 @@ function RouteComponent() { (x: any) => x.id === Number(data[0].currentLoadingOrder), ) : []; + return (
@@ -138,7 +146,7 @@ function RouteComponent() { )}

-
+
{ @@ -166,29 +174,32 @@ function RouteComponent() {
- -
- - -
+ {loadingPlan && loadingPlan.length > 0 && ( +
+ + {canReadWarehouse && ( + + )} +
+ )}
diff --git a/migrations/0063_illegal_mauler.sql b/migrations/0063_illegal_mauler.sql new file mode 100644 index 0000000..600da93 --- /dev/null +++ b/migrations/0063_illegal_mauler.sql @@ -0,0 +1 @@ +ALTER TABLE "opendock_apt" ADD COLUMN "status" text DEFAULT 'active'; \ No newline at end of file diff --git a/migrations/meta/0063_snapshot.json b/migrations/meta/0063_snapshot.json new file mode 100644 index 0000000..6a4e0f3 --- /dev/null +++ b/migrations/meta/0063_snapshot.json @@ -0,0 +1,2696 @@ +{ + "id": "14f6a7c0-9e64-4245-8536-316da4a0c9fd", + "prevId": "3c1e6107-9afd-4186-ac57-31c5ae782d2b", + "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": {}, + "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 + }, + "status": { + "name": "status", + "type": "text", + "primaryKey": false, + "notNull": false, + "default": "'active'" + }, + "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 4c71a88..b8166f2 100644 --- a/migrations/meta/_journal.json +++ b/migrations/meta/_journal.json @@ -442,6 +442,13 @@ "when": 1781009330205, "tag": "0062_square_harrier", "breakpoints": true + }, + { + "idx": 63, + "version": "7", + "when": 1781045714275, + "tag": "0063_illegal_mauler", + "breakpoints": true } ] } \ No newline at end of file