feat(ocp): create and book in plus dyco controller implemented

This commit is contained in:
2025-03-26 22:07:19 -05:00
parent 878e650e62
commit 7a1a4773e7
23 changed files with 1233 additions and 40 deletions

View File

@@ -3,20 +3,41 @@
* this will only run on a server start up
*/
import {db} from "../../../../database/dbclient.js";
import {settings} from "../../../../database/schema/settings.js";
import { db } from "../../../../database/dbclient.js";
import { settings } from "../../../../database/schema/settings.js";
import {createLog} from "../../logger/logger.js";
import { createLog } from "../../logger/logger.js";
// "view", "technician", "supervisor","manager", "admin", "systemAdmin"
const newSettings = [
{name: "server", value: "localhost", description: "Where the app runs at", moduleName: "server"},
{name: "serverPort", value: "4400", description: "What are we listening on", moduleName: "server"},
{name: "dbUser", value: "alplaprod", description: "What is the db username", moduleName: "server"},
{name: "dbPass", value: "b2JlbGl4", description: "What is the db password", moduleName: "server"},
{
name: "server",
value: "localhost",
description: "Where the app runs at",
moduleName: "server",
},
{
name: "serverPort",
value: "4400",
description: "What are we listening on",
moduleName: "server",
},
{
name: "dbUser",
value: "alplaprod",
description: "What is the db username",
moduleName: "server",
},
{
name: "dbPass",
value: "b2JlbGl4",
description: "What is the db password",
moduleName: "server",
},
{
name: "tcpPort",
value: "2222",
description: "TCP port for printers to connect send data and the zedra cameras",
description:
"TCP port for printers to connect send data and the zedra cameras",
moduleName: "server",
},
{
@@ -59,13 +80,15 @@ const newSettings = [
{
name: "ocmeService",
value: "0",
description: "Is the ocme service enabled. this is gernerally only for Dayton.",
description:
"Is the ocme service enabled. this is gernerally only for Dayton.",
moduleName: "ocme",
},
{
name: "fifoCheck",
value: "45",
description: "How far back do we want to check for fifo default 45, putting 0 will ignore.",
description:
"How far back do we want to check for fifo default 45, putting 0 will ignore.",
moduleName: "ocme",
},
{
@@ -83,7 +106,8 @@ const newSettings = [
{
name: "monitorAddress",
value: "8",
description: "What address is monitored to be limited to the amount of lots that can be added to a truck.",
description:
"What address is monitored to be limited to the amount of lots that can be added to a truck.",
moduleName: "ocme",
},
{
@@ -96,7 +120,8 @@ const newSettings = [
{
name: "devDir",
value: "C:\\Users\\matthes01\\Documents\\lstv2",
description: "This is the dev dir and strictly only for updating the servers.",
description:
"This is the dev dir and strictly only for updating the servers.",
moduleName: "server",
},
{
@@ -116,7 +141,30 @@ const newSettings = [
{
name: "ocpLogsCheck",
value: "4",
description: "How long do we want to allow logs to show that have not been cleared?",
description:
"How long do we want to allow logs to show that have not been cleared?",
roles: "admin",
module: "ocp",
},
{
name: "inhouseDelivery",
value: "0",
description: "Are we doing auto inhouse delivery?",
roles: "admin",
module: "ocp",
},
// dyco settings
{
name: "dycoConnect",
value: "0",
description: "Are we running the dyco system?",
roles: "admin",
module: "ocp",
},
{
name: "dycoPrint",
value: "0",
description: "Are we using the dyco to get the labels or the rfid?",
roles: "admin",
module: "ocp",
},
@@ -129,16 +177,31 @@ export const areSettingsIn = async () => {
if (settingsCheck.length !== newSettings.length) {
try {
const newRole = await db
.insert(settings)
.values(newSettings)
.onConflictDoNothing() // this will only update the ones that are new :D
.returning({name: settings.name});
createLog("info", "lst", "server", "Settingss were just added due to missing them on server startup");
.insert(settings)
.values(newSettings)
.onConflictDoNothing() // this will only update the ones that are new :D
.returning({ name: settings.name });
createLog(
"info",
"lst",
"server",
"Settingss were just added due to missing them on server startup"
);
} catch (error) {
createLog("error", "lst", "server", "There was an error adding new roles to the db");
createLog(
"error",
"lst",
"server",
"There was an error adding new roles to the db"
);
}
}
} catch (error) {
createLog("error", "lst", "server", "There was an error getting or adding new Settingss");
createLog(
"error",
"lst",
"server",
"There was an error getting or adding new Settingss"
);
}
};