diff --git a/backend/db/schema/scanUsers.ts b/backend/db/schema/scanUsers.ts
index c4ac877..74589ac 100644
--- a/backend/db/schema/scanUsers.ts
+++ b/backend/db/schema/scanUsers.ts
@@ -1,5 +1,6 @@
import {
boolean,
+ jsonb,
pgEnum,
pgTable,
text,
@@ -25,7 +26,7 @@ export const scanUser = pgTable(
scannerId: text("scanner_id").unique().notNull(),
pinNumber: text("pin_number").unique().notNull(),
pinHash: text("pin_hash").notNull(),
- excludedCommand: text("excluded_commands").default(""),
+ excludedCommand: jsonb("excluded_commands").default([]),
role: mobileRoleEnum("role").notNull().default("user"),
active: boolean("active").default(true),
lastScan: timestamp("last_scan").defaultNow(),
diff --git a/backend/db/schema/scanlog.schema.ts b/backend/db/schema/scanlog.schema.ts
index c17e0cb..721557e 100644
--- a/backend/db/schema/scanlog.schema.ts
+++ b/backend/db/schema/scanlog.schema.ts
@@ -4,6 +4,7 @@ import type z from "zod";
export const scanLog = pgTable("scan_log", {
id: uuid("id").defaultRandom().primaryKey(),
+ user: text("user"),
scannerId: text("scanner_id"),
message: text("message").notNull(),
prompt: text("prompt"),
diff --git a/lstMobile/app.json b/lstMobile/app.json
index ef960fa..42d4d41 100644
--- a/lstMobile/app.json
+++ b/lstMobile/app.json
@@ -15,7 +15,7 @@
"foregroundImage": "./assets/adaptive-icon-white.png",
"backgroundColor": "#ffffff"
},
- "versionCode": 23,
+ "versionCode": 24,
"minSupportedVersionCode": 21,
"predictiveBackGestureEnabled": false,
"package": "net.alpla.lst.mobile"
diff --git a/lstMobile/assets/sounds/scan.wav b/lstMobile/assets/sounds/scan.wav
new file mode 100644
index 0000000..015e1f6
Binary files /dev/null and b/lstMobile/assets/sounds/scan.wav differ
diff --git a/lstMobile/src/app/(tabs)/_layout.tsx b/lstMobile/src/app/(tabs)/_layout.tsx
index 63d1005..bcdeb4f 100644
--- a/lstMobile/src/app/(tabs)/_layout.tsx
+++ b/lstMobile/src/app/(tabs)/_layout.tsx
@@ -1,9 +1,32 @@
-import { Tabs } from "expo-router";
-import { Home, Settings } from "lucide-react-native";
+import { Redirect, Tabs } from "expo-router";
+import { Container, Home, Logs, Rows4, Settings } from "lucide-react-native";
import { useAppStore } from "../../hooks/useAppStore";
+import { useMobileAuthStore } from "../../hooks/useMobileAuth";
+
+// const roles = {
+// adminOnly: ["admin"],
+// management: ["admin", "manager"],
+// allStaff: ["admin", "manager", "driver", "lead", "user"],
+// };
export default function TabsLayout() {
const serverPort = useAppStore((s) => s.serverPort);
+ const user = useMobileAuthStore((s) => s.user);
+ const isUnlocked = useMobileAuthStore((s) => s.isUnlocked);
+
+ const port = parseInt(serverPort || "0", 10) >= 50000;
+
+ if (!user || (!isUnlocked && !port)) {
+ return ;
+ }
+
+ const isNormalScanner = parseInt(serverPort || "0", 10) >= 50000;
+
+ const hasRole = (allowed: string[] = []) => {
+ const role = user?.role?.toLowerCase();
+ return role ? allowed.includes(role) : false;
+ };
+
return (
,
+ }}
+ />
+ (
-
+
),
}}
/>
@@ -40,7 +76,10 @@ export default function TabsLayout() {
options={{
title: "Logs",
href:
- parseInt(serverPort || "0", 10) >= 50000 ? null : "/(tabs)/logs",
+ isNormalScanner || !hasRole(["admin", "manager"])
+ ? null
+ : "/(tabs)/logs",
+ tabBarIcon: ({ color, size }) => ,
}}
/>
{/* = 50000 ? null : "/(tabs)/logs",
}}
/> */}
+ (
+
+ ),
+ }}
+ />
);
}
diff --git a/lstMobile/src/app/(tabs)/config.tsx b/lstMobile/src/app/(tabs)/config.tsx
index 0a505f5..4b93f5d 100644
--- a/lstMobile/src/app/(tabs)/config.tsx
+++ b/lstMobile/src/app/(tabs)/config.tsx
@@ -1,7 +1,5 @@
-import { Link } from "expo-router";
-import { Text, View } from "react-native";
import Setup from "../setup";
export default function SettingsTab() {
- return
-}
\ No newline at end of file
+ return ;
+}
diff --git a/lstMobile/src/app/(tabs)/dockScan.tsx b/lstMobile/src/app/(tabs)/dockScan.tsx
new file mode 100644
index 0000000..690ae5f
--- /dev/null
+++ b/lstMobile/src/app/(tabs)/dockScan.tsx
@@ -0,0 +1,26 @@
+import React from "react";
+import { Text, View } from "react-native";
+import { Button } from "../../components/ui/button";
+
+export default function LaneCheck() {
+ const getInfo = async () => {
+ const info = "ho";
+
+ console.log(info);
+ };
+ return (
+
+ Dock Scanning
+
+
+ );
+}
diff --git a/lstMobile/src/app/(tabs)/laneCheck.tsx b/lstMobile/src/app/(tabs)/laneCheck.tsx
new file mode 100644
index 0000000..60fca05
--- /dev/null
+++ b/lstMobile/src/app/(tabs)/laneCheck.tsx
@@ -0,0 +1,37 @@
+import React, { useCallback, useEffect } from "react";
+import { Text, View } from "react-native";
+import { Button } from "../../components/ui/button";
+import { type ZebraScanResult, zebraScanner } from "../../lib/ZebraScanner";
+
+export default function LaneCheck() {
+ const handleScan = useCallback(async (scan: ZebraScanResult) => {
+ console.log(scan);
+ }, []);
+
+ useEffect(() => {
+ zebraScanner.ensureProfile();
+ zebraScanner.startListening();
+
+ const sub = zebraScanner.addScanListener((scan) => {
+ //console.log("SCAN:", scan);
+ handleScan(scan);
+ });
+
+ return () => {
+ sub.remove();
+ zebraScanner.stopListening();
+ };
+ }, [handleScan]);
+ return (
+
+ LaneChecks
+
+ );
+}
diff --git a/lstMobile/src/app/_layout.tsx b/lstMobile/src/app/_layout.tsx
index f9691d5..3aed40d 100644
--- a/lstMobile/src/app/_layout.tsx
+++ b/lstMobile/src/app/_layout.tsx
@@ -1,26 +1,21 @@
+import { PortalHost } from "@rn-primitives/portal";
import { Stack } from "expo-router";
import { StatusBar } from "expo-status-bar";
import "../../global.css";
-import { PortalHost } from "@rn-primitives/portal";
-import { View } from "react-native";
+import useDeviceLock from "../hooks/useDeviceCheck";
export default function RootLayout() {
+ useDeviceLock();
+
return (
<>
-
-
-
+
+
+
+
>
diff --git a/lstMobile/src/app/index.tsx b/lstMobile/src/app/index.tsx
index 8bd0236..a1f43b8 100644
--- a/lstMobile/src/app/index.tsx
+++ b/lstMobile/src/app/index.tsx
@@ -1,127 +1,31 @@
-import axios from "axios";
-import Constants from "expo-constants";
-import { Redirect, useRouter } from "expo-router";
-import { useEffect, useState } from "react";
+import { Redirect } from "expo-router";
import { ActivityIndicator, Text, View } from "react-native";
-import { useAppStore } from "../hooks/useAppStore";
-import { useMobileAuthStore } from "../hooks/useMobileAuth";
-import { useServerStore } from "../hooks/useServerCheck";
-import { devDelay } from "../lib/devMode";
+import { useAppStartup } from "../hooks/useAppStartup";
+
+const startupMessages = {
+ loading: "Loading app...",
+ validating: "Validating data...",
+ scannerMode: "Checking scanner mode...",
+ normalScanner: "Starting normal ALPLAprod scanner that has no LST rules",
+ checkingUpdates: "Checking for updates...",
+ opening: "Opening LST scan app...",
+ error: "Something went wrong during startup.",
+};
export default function Index() {
- const router = useRouter();
- const [message, setMessage] = useState(Starting app...);
- const [ready, setReady] = useState(false);
- const setServerVersion = useServerStore((s) => s.setServerVersion);
- //const { isUnlocked } = useMobileAuthStore();
+ const { ready, startupRoute, status } = useAppStartup();
- const hasHydrated = useAppStore((s) => s.hasHydrated);
- const serverPort = useAppStore((s) => s.serverPort);
- const serverIp = useAppStore((s) => s.serverIp);
- const build = Constants.expoConfig?.android?.versionCode ?? 1;
- const hasValidSetup = useAppStore((s) => s.hasValidSetup);
-
- useEffect(() => {
- if (!hasHydrated) {
- setMessage(Loading app...);
- return;
- }
-
- const startup = async () => {
- try {
- await devDelay(1500);
-
- setMessage(Validating data...);
- await devDelay(1500);
-
- if (!hasValidSetup()) {
- router.replace("/setup");
- return;
- }
-
- // checking for lst.
- console.log(
- `http://${serverIp}:${parseInt(serverPort || "0", 10) >= 50000 ? "3000" : serverPort}/lst/api/mobile/version`,
- );
- try {
- const res = await axios.get(
- `http://${serverIp}:${parseInt(serverPort || "0", 10) >= 50000 ? "3000" : serverPort}/lst/api/mobile/version`,
- {
- timeout: 5000,
- },
- );
-
- console.log(res.data);
-
- // if the build version dose not match the latest server version force update
- if (res.status === 200) {
- setServerVersion(res.data);
- }
-
- // TODO: change the header to show orange and theres a new version
- // console.log(build < res.data.minSupportedVersionCode);
- // if (build < res.data.minSupportedVersionCode) {
- // router.replace("/updateScreen");
- // return;
- // }
- } catch (error) {
- console.log("Error: ", error);
- }
-
- setMessage(Checking scanner mode...);
- await devDelay(1500);
-
- if (parseInt(serverPort || "0", 10) >= 50000) {
- setMessage(
-
- Starting normal alplaprod scanner that has no LST rules
- ,
- );
- await devDelay(1500);
- //router.replace("/scanner");
- setReady(true);
- return;
- }
-
- setMessage(Checking for updates);
- await devDelay(1500);
- // TODO if theres an update go to update screen message :D
- setMessage(Opening LST scan app);
- await devDelay(3250);
-
- setReady(true);
- } catch (error) {
- console.log("Startup error", error);
- setMessage(Something went wrong during startup.);
- }
- };
-
- startup();
- }, [
- hasHydrated,
- hasValidSetup,
- serverPort,
- serverIp,
- router,
- setServerVersion,
- ]);
-
- // if (ready && !isUnlocked) {
- // return ;
- // }
- if (ready) {
- return ;
+ if (ready && startupRoute) {
+ return ;
}
+
+ if (ready) {
+ return ;
+ }
+
return (
-
- {message}
+
+ {startupMessages[status]}
);
diff --git a/lstMobile/src/app/login.tsx b/lstMobile/src/app/login.tsx
index 18f3acc..a4dd642 100644
--- a/lstMobile/src/app/login.tsx
+++ b/lstMobile/src/app/login.tsx
@@ -1,27 +1,49 @@
import axios from "axios";
-import Constants from "expo-constants";
+
import { useRouter } from "expo-router";
import { useState } from "react";
-import { Alert, Button, Text, View } from "react-native";
+import { Button, Text, View } from "react-native";
import { Input } from "../components/ui/input";
import { useAppStore } from "../hooks/useAppStore";
import { useMobileAuthStore } from "../hooks/useMobileAuth";
export default function Login() {
- const { setUser } = useMobileAuthStore();
+ // doing this causes rerender and sub
+ //const { setUser } = useMobileAuthStore();
+ const [pin, setPin] = useState("");
const serverPort = useAppStore((s) => s.serverPort);
const serverIp = useAppStore((s) => s.serverIp);
+
+ const router = useRouter();
+
const onLogin = async () => {
+ if (pin.length < 6) {
+ console.log("pin must be min 6 ");
+ }
+ console.log(pin);
try {
- const res = await axios.get(
- `http://${serverIp}:${parseInt(serverPort || "0", 10) >= 50000 ? "3000" : serverPort}/lst/api/mobile/version`,
+ const res = await axios.post(
+ `http://${serverIp}:${parseInt(serverPort || "0", 10) >= 50000 ? "3000" : serverPort}/lst/api/mobile/auth/pin`,
+ { pin },
+
{
timeout: 5000,
},
);
- console.log(res.data);
- } catch (error) {}
+ if (res.status === 200) {
+ // this way to set the user is direct and basically a 1 shot
+ useMobileAuthStore.getState().setUser(res.data.data);
+ return router.replace("/(tabs)/scanner");
+ }
+ } catch (error) {
+ console.log(error);
+ }
+ };
+
+ const config = () => {
+ console.log("config");
+ return router.replace("/setup");
};
return (
@@ -43,10 +65,21 @@ export default function Login() {
keyboardType="number-pad"
textContentType="oneTimeCode"
placeholder="Pin number"
+ onChangeText={setPin}
/>
-
+
+
+ Warning: If you are logged into another scanner you will encounter
+ scan errors, please do not try to log into more than 1 scanner at a
+ time.
+
+
+
+
+
+
);
}
diff --git a/lstMobile/src/app/setup.tsx b/lstMobile/src/app/setup.tsx
index 97eff78..7c672cb 100644
--- a/lstMobile/src/app/setup.tsx
+++ b/lstMobile/src/app/setup.tsx
@@ -151,7 +151,7 @@ export default function Setup() {
marginTop: "auto",
alignItems: "center",
padding: 10,
- marginBottom: 12,
+ marginBottom: 50,
}}
>
diff --git a/lstMobile/src/components/LSTScanner.tsx b/lstMobile/src/components/LSTScanner.tsx
index ace9bab..c621ab0 100644
--- a/lstMobile/src/components/LSTScanner.tsx
+++ b/lstMobile/src/components/LSTScanner.tsx
@@ -1,15 +1,133 @@
-import { useCallback, useEffect } from "react";
-import { Text, View } from "react-native";
+import axios from "axios";
+import { format } from "date-fns-tz";
+import { useCallback, useEffect, useState } from "react";
+import { Alert, Button, Text, View } from "react-native";
+import { useAppStore } from "../hooks/useAppStore";
+import { useMobileAuthStore } from "../hooks/useMobileAuth";
+import { useScannerStore } from "../hooks/useScannerStore";
+import { scannerFeedback } from "../lib/feedbackScan";
+import { sendTcpMessage } from "../lib/tcpScan";
+import { type ZebraScanResult, zebraScanner } from "../lib/ZebraScanner";
+import { ScannedLabelBox } from "./ScannedLabels";
+import { GlobalFooter } from "./UpdateFooter";
+import { Separator } from "./ui/separator";
-import { zebraScanner } from "../lib/ZebraScanner";
+const STX = "\x02";
+const ETX = "\x03";
+
+const formatName = (name?: string) =>
+ name ? name.charAt(0).toUpperCase() + name.slice(1).toLowerCase() : "";
export default function LSTScanner() {
- const handleScan = useCallback(async (scan: any) => {
- console.log(scan);
- }, []);
+ const user = useMobileAuthStore((s) => s.user);
+ const logout = useMobileAuthStore((s) => s.logout);
+
+ // TODO : move to off tcp stuff after od
+ const lastScan = useScannerStore((s) => s.lastScan);
+ const setLastScan = useScannerStore((s) => s.setLastScan);
+ const [tagScans, setTagScans] = useState([]);
+ const scannerIdFromStore = useAppStore((s) => s.scannerId);
+ const serverIp = useAppStore((s) => s.serverIp);
+ const serverPort = useAppStore((s) => s.serverPort);
+ const [bgColor, setBGColor] = useState(null);
+
+ const handleScan = useCallback(
+ async (scan: ZebraScanResult) => {
+ await scannerFeedback({
+ type: "scan",
+ sound: true,
+ vibrate: true,
+ led: true,
+ });
+
+ const isAlphaStart = /^[a-zA-Z]/.test(scan.data);
+ const isExcluded = (user?.excludedCommand ?? []).some((cmd) =>
+ scan.data.toLowerCase().includes(cmd.toLowerCase()),
+ );
+
+ if (isAlphaStart && isExcluded) {
+ Alert.alert(
+ `Command: ${scan.data} is not allowed to be used, please contact logistics if this is an error`,
+ );
+ }
+
+ let commandToSend = `${STX}${user?.scannerId}@${scan.data}${ETX}`;
+
+ // if we are sscc we need to scan like this .... 98@]C100090087710038712256
+ if (scan.data.startsWith("000")) {
+ commandToSend = `${STX}${user?.scannerId}@]C1${scan.data}${ETX}`;
+ setTagScans((prev: any) => [
+ {
+ label: parseInt(scan.data.slice(10, -1) || "000", 10).toString(),
+ date: format(new Date(Date.now()), "HH:mm"),
+ },
+ ...prev,
+ ]);
+ }
+
+ const scanned = (await sendTcpMessage(
+ commandToSend,
+ serverIp,
+ parseInt(serverPort || "0", 10),
+ )) as any;
+ // send the logs to lst but allow it to time out if it dose not exist just bc.
+ const logInfo = { ...scanned, user: user?.name };
+
+ try {
+ await axios.post(
+ `http://${serverIp.trim()}:3000/lst/api/mobile/logs`,
+ logInfo,
+ );
+ } catch (error) {
+ console.log(error);
+ }
+ // const response = await sendTcpMessage(tcpMessage);
+ console.log(scanned.data);
+ if (scanned.data.status !== "error") {
+ await scannerFeedback({
+ type: "good",
+ sound: true,
+ vibrate: true,
+ led: true,
+ });
+ setBGColor("bg-green-500");
+ setTimeout(() => {
+ setBGColor(null);
+ }, 1 * 1000);
+ }
+
+ if (scanned.data.status === "error") {
+ await scannerFeedback({
+ type: scanned.data.status === "error" ? "bad" : "good",
+ sound: true,
+ vibrate: true,
+ led: true,
+ });
+ setBGColor("bg-red-500");
+ setTimeout(() => {
+ setBGColor(null);
+ }, 1 * 1000);
+ }
+ setLastScan(scanned.data);
+
+ // if we change commands we want to zero out the last scanned labels
+ if (isAlphaStart) {
+ setTagScans([]);
+ }
+ },
+ [
+ serverIp,
+ serverPort,
+ setLastScan,
+ user?.scannerId,
+ user?.name,
+ user?.excludedCommand?.some,
+ user?.excludedCommand,
+ ],
+ );
const clearScans = () => {
- // add in
+ setTagScans([]);
};
//console.log(lastScan);
@@ -29,23 +147,69 @@ export default function LSTScanner() {
};
}, [handleScan]);
return (
-
-
- LST Scanner
+
+
+
+ User: {formatName(user?.name ?? "")}
+
+
+ LST Scanner id: {user?.scannerId}
+
+
+ {!lastScan ? (
+
+ Ready to scan
+ Waiting for first scan...
+
+ ) : (
+
+ {lastScan.lines
+ ?.filter((line) => !/^\d+@$/.test(line))
+ .map((i) => {
+ return (
+
+
+ {i}
+
+
+ );
+ })}
+
+ )}
+
-
- Relocate
- 0 / 4
+
+
+
- {/*
- List of recent scanned pallets TBA
- */}
+
+ {user && (
+
+
+
+ )}
+
+
+
+
);
}
diff --git a/lstMobile/src/components/ProdScanner.tsx b/lstMobile/src/components/ProdScanner.tsx
index 6dd75f9..f3ba186 100644
--- a/lstMobile/src/components/ProdScanner.tsx
+++ b/lstMobile/src/components/ProdScanner.tsx
@@ -25,6 +25,13 @@ export default function ProdScanner() {
const handleScan = useCallback(
async (scan: ZebraScanResult) => {
+ await scannerFeedback({
+ type: "scan",
+ sound: true,
+ vibrate: true,
+ led: true,
+ });
+
let commandToSend = `${STX}${scannerIdFromStore}@${scan.data}${ETX}`;
// if we are sscc we need to scan like this .... 98@]C100090087710038712256
diff --git a/lstMobile/src/hooks/useAppStartup.tsx b/lstMobile/src/hooks/useAppStartup.tsx
new file mode 100644
index 0000000..1d7a50b
--- /dev/null
+++ b/lstMobile/src/hooks/useAppStartup.tsx
@@ -0,0 +1,133 @@
+import axios from "axios";
+import Constants from "expo-constants";
+import { useEffect, useRef, useState } from "react";
+import { devDelay } from "../lib/devMode";
+import { useAppStore } from "./useAppStore";
+import { useServerStore } from "./useServerCheck";
+
+type StartupStatus =
+ | "loading"
+ | "validating"
+ | "scannerMode"
+ | "normalScanner"
+ | "checkingUpdates"
+ | "opening"
+ | "error";
+
+export function useAppStartup() {
+ const [ready, setReady] = useState(false);
+ const [status, setStatus] = useState("loading");
+ const [startupRoute, setStartupRoute] = useState(null);
+
+ const hasRunKey = useRef(null);
+
+ const hasHydrated = useAppStore((s) => s.hasHydrated);
+ const serverPort = useAppStore((s) => s.serverPort);
+ const serverIp = useAppStore((s) => s.serverIp);
+ const setServerVersion = useServerStore((s) => s.setServerVersion);
+
+ useEffect(() => {
+ if (!hasHydrated) {
+ setStatus("loading");
+ return;
+ }
+
+ const runKey = `${serverIp}:${serverPort}`;
+
+ if (hasRunKey.current === runKey) {
+ return;
+ }
+
+ hasRunKey.current = runKey;
+
+ let cancelled = false;
+
+ const startup = async () => {
+ try {
+ setReady(false);
+ setStartupRoute(null);
+
+ await devDelay(1500);
+ if (cancelled) return;
+
+ setStatus("validating");
+ await devDelay(1500);
+ if (cancelled) return;
+
+ const hasValidSetup = useAppStore.getState().hasValidSetup;
+
+ if (!hasValidSetup()) {
+ setStartupRoute("/setup");
+ setReady(true);
+ return;
+ }
+
+ const port =
+ parseInt(serverPort || "0", 10) >= 50000 ? "3000" : serverPort;
+
+ try {
+ const res = await axios.get(
+ `http://${serverIp}:${port}/lst/api/mobile/version`,
+ { timeout: 5000 },
+ );
+
+ if (res.status === 200) {
+ setServerVersion(res.data);
+ }
+
+ const build = Constants.expoConfig?.android?.versionCode ?? 1;
+
+ if (build < res.data.minSupportedVersionCode) {
+ setStartupRoute("/updateScreen");
+ setReady(true);
+ return;
+ }
+ } catch (error) {
+ console.log("Version check error:", error);
+ }
+
+ setStatus("scannerMode");
+ await devDelay(1500);
+ if (cancelled) return;
+
+ if (parseInt(serverPort || "0", 10) >= 50000) {
+ setStatus("normalScanner");
+ await devDelay(1500);
+
+ setStartupRoute("/scanner");
+ setReady(true);
+ return;
+ }
+
+ setStatus("checkingUpdates");
+ console.log("checking updates");
+ await devDelay(1500);
+ if (cancelled) return;
+
+ setStatus("opening");
+ console.log("opening");
+ await devDelay(1500);
+ if (cancelled) return;
+
+ setStartupRoute("/(tabs)/scanner");
+ console.log("scanner");
+ setReady(true);
+ } catch (error) {
+ console.log("Startup error:", error);
+ setStatus("error");
+ }
+ };
+
+ startup();
+
+ return () => {
+ cancelled = true;
+ };
+ }, [hasHydrated, serverIp, serverPort, setServerVersion]);
+
+ return {
+ ready,
+ startupRoute,
+ status,
+ };
+}
diff --git a/lstMobile/src/hooks/useDeviceCheck.tsx b/lstMobile/src/hooks/useDeviceCheck.tsx
new file mode 100644
index 0000000..457e1c5
--- /dev/null
+++ b/lstMobile/src/hooks/useDeviceCheck.tsx
@@ -0,0 +1,33 @@
+import { useEffect, useRef, useState } from "react";
+import { AppState, type AppStateStatus } from "react-native";
+import { useMobileAuthStore } from "./useMobileAuth";
+
+export default function useDeviceLock() {
+ const [appState, setAppState] = useState(
+ AppState.currentState,
+ );
+ const appStateRef = useRef(AppState.currentState);
+
+ useEffect(() => {
+ const subscription = AppState.addEventListener("change", (nextAppState) => {
+ const previousAppState = appStateRef.current;
+
+ const wasActive = previousAppState === "active";
+
+ // if the we see aggressive locking then we should remove inactive.
+ const isNowInactive =
+ nextAppState === "background" || nextAppState === "inactive";
+
+ if (wasActive && isNowInactive) {
+ useMobileAuthStore.getState().lock();
+ }
+
+ appStateRef.current = nextAppState;
+ setAppState(nextAppState);
+ });
+
+ return () => subscription.remove();
+ }, []);
+
+ return appState;
+}
diff --git a/lstMobile/src/hooks/useMobileAuth.ts b/lstMobile/src/hooks/useMobileAuth.ts
index 8d41916..8652f08 100644
--- a/lstMobile/src/hooks/useMobileAuth.ts
+++ b/lstMobile/src/hooks/useMobileAuth.ts
@@ -5,6 +5,7 @@ type MobileUser = {
name: string;
role: "user" | "lead" | "manager" | "admin";
excludedCommand: string[];
+ scannerId: string;
};
type AuthState = {
diff --git a/lstMobile/src/lib/feedbackScan.ts b/lstMobile/src/lib/feedbackScan.ts
index 6bc5bc1..6df14f7 100644
--- a/lstMobile/src/lib/feedbackScan.ts
+++ b/lstMobile/src/lib/feedbackScan.ts
@@ -2,12 +2,13 @@ import { createAudioPlayer } from "expo-audio";
import * as Haptics from "expo-haptics";
export type ScanFeedback = {
- type: "good" | "bad";
+ type: "good" | "bad" | "scan";
sound?: boolean;
vibrate?: boolean;
led?: boolean;
};
+const scan = createAudioPlayer(require("../../assets/sounds/scan.wav"));
const goodSound = createAudioPlayer(require("../../assets/sounds/good.wav"));
const badSound = createAudioPlayer(require("../../assets/sounds/bad.wav"));
@@ -18,14 +19,15 @@ export async function scannerFeedback({
led = true,
}: ScanFeedback) {
if (sound) {
- const player = type === "good" ? goodSound : badSound;
+ const player =
+ type === "scan" ? scan : type === "good" ? goodSound : badSound;
player.seekTo(0);
player.play();
}
if (vibrate) {
await Haptics.notificationAsync(
- type === "good"
+ type === "good" || type === "scan"
? Haptics.NotificationFeedbackType.Success
: Haptics.NotificationFeedbackType.Error,
);
diff --git a/migrations/0045_quick_khan.sql b/migrations/0045_quick_khan.sql
new file mode 100644
index 0000000..86472d9
--- /dev/null
+++ b/migrations/0045_quick_khan.sql
@@ -0,0 +1,3 @@
+ALTER TABLE "scan_users" ALTER COLUMN "excluded_commands" SET DATA TYPE jsonb;--> statement-breakpoint
+ALTER TABLE "scan_users" ALTER COLUMN "excluded_commands" SET DEFAULT '';--> statement-breakpoint
+ALTER TABLE "scan_log" ADD COLUMN "user" text;
\ No newline at end of file
diff --git a/migrations/0046_chemical_the_leader.sql b/migrations/0046_chemical_the_leader.sql
new file mode 100644
index 0000000..643065c
--- /dev/null
+++ b/migrations/0046_chemical_the_leader.sql
@@ -0,0 +1 @@
+ALTER TABLE "scan_users" ALTER COLUMN "excluded_commands" SET DEFAULT '[]'::jsonb;
\ No newline at end of file
diff --git a/migrations/meta/0045_snapshot.json b/migrations/meta/0045_snapshot.json
new file mode 100644
index 0000000..07eaca5
--- /dev/null
+++ b/migrations/meta/0045_snapshot.json
@@ -0,0 +1,2149 @@
+{
+ "id": "9619fdfb-3888-44d6-b9f1-c72654bfe210",
+ "prevId": "76487216-dea9-4216-b283-c20e4abc444e",
+ "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",
+ "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",
+ "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",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "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",
+ "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",
+ "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",
+ "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",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "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",
+ "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",
+ "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.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",
+ "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",
+ "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",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "opendock_apt_release_idx": {
+ "name": "opendock_apt_release_idx",
+ "columns": [
+ {
+ "expression": "release",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "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.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",
+ "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",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "upd_date": {
+ "name": "upd_date",
+ "type": "timestamp",
+ "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
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lines": {
+ "name": "lines",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'[]'::jsonb"
+ },
+ "add_Date": {
+ "name": "add_Date",
+ "type": "timestamp",
+ "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": "''"
+ },
+ "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",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "upd_date": {
+ "name": "upd_date",
+ "type": "timestamp",
+ "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",
+ "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",
+ "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",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "name": {
+ "name": "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.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",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_deploy_at": {
+ "name": "last_deploy_at",
+ "type": "timestamp",
+ "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",
+ "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.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/0046_snapshot.json b/migrations/meta/0046_snapshot.json
new file mode 100644
index 0000000..5abea41
--- /dev/null
+++ b/migrations/meta/0046_snapshot.json
@@ -0,0 +1,2149 @@
+{
+ "id": "ead555a1-51be-4255-880e-4d691baf816e",
+ "prevId": "9619fdfb-3888-44d6-b9f1-c72654bfe210",
+ "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",
+ "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",
+ "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",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "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",
+ "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",
+ "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",
+ "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",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {},
+ "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",
+ "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",
+ "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.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",
+ "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",
+ "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",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ },
+ "created_at": {
+ "name": "created_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "opendock_apt_release_idx": {
+ "name": "opendock_apt_release_idx",
+ "columns": [
+ {
+ "expression": "release",
+ "isExpression": false,
+ "asc": true,
+ "nulls": "last"
+ }
+ ],
+ "isUnique": false,
+ "concurrently": false,
+ "method": "btree",
+ "with": {}
+ },
+ "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.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",
+ "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",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "upd_date": {
+ "name": "upd_date",
+ "type": "timestamp",
+ "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
+ },
+ "status": {
+ "name": "status",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "lines": {
+ "name": "lines",
+ "type": "jsonb",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "'[]'::jsonb"
+ },
+ "add_Date": {
+ "name": "add_Date",
+ "type": "timestamp",
+ "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",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ },
+ "upd_date": {
+ "name": "upd_date",
+ "type": "timestamp",
+ "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",
+ "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",
+ "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",
+ "primaryKey": false,
+ "notNull": false,
+ "default": "now()"
+ }
+ },
+ "indexes": {
+ "name": {
+ "name": "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.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",
+ "primaryKey": false,
+ "notNull": false
+ },
+ "last_deploy_at": {
+ "name": "last_deploy_at",
+ "type": "timestamp",
+ "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",
+ "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.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 ae69f5c..46f632c 100644
--- a/migrations/meta/_journal.json
+++ b/migrations/meta/_journal.json
@@ -316,6 +316,20 @@
"when": 1777666145468,
"tag": "0044_steady_magneto",
"breakpoints": true
+ },
+ {
+ "idx": 45,
+ "version": "7",
+ "when": 1778059667805,
+ "tag": "0045_quick_khan",
+ "breakpoints": true
+ },
+ {
+ "idx": 46,
+ "version": "7",
+ "when": 1778059910210,
+ "tag": "0046_chemical_the_leader",
+ "breakpoints": true
}
]
}
\ No newline at end of file