feat(servers): all servers in v2 meow

This commit is contained in:
2025-04-02 21:26:32 -05:00
parent f771db6034
commit d27611d035
5 changed files with 233 additions and 57 deletions

View File

@@ -18,7 +18,7 @@
"oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{ "specialInstructions": "something for ti" }]
"otherSettings": [{ "specialInstructions": "" }]
},
{
"sName": "Bethlehem",
@@ -38,7 +38,7 @@
"oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{ "specialInstructions": "something for ti" }]
"otherSettings": [{ "specialInstructions": "" }]
},
{
"sName": "Huston",
@@ -58,7 +58,7 @@
"oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{ "specialInstructions": "something for ti" }]
"otherSettings": [{ "specialInstructions": "" }]
},
{
"sName": "Bowling Green 1",
@@ -69,16 +69,20 @@
"streetAddress": "215 Technology Way",
"cityState": "Bowling Green, KY",
"zipcode": "42101",
"contactEmail": "blake.matthes@alpla.com",
"contactPhone": "6366970253",
"contactEmail": "ShippingReceivingBowlingGreen1@groups.alpla.com",
"contactPhone": "(270) 495-6647",
"customerTiAcc": "ALPL01BG1INT",
"lstServerPort": "4000",
"active": true,
"serverLoc": "E:\\LST\\lstv2",
"oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"shippingHours": "[{\"early\": \"00:00\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{ "specialInstructions": "something for ti" }]
"otherSettings": [
{
"specialInstructions": "Please be sure to schedule a pick up appointment and bring 2 load bars to secure the load."
}
]
},
{
"sName": "Iowa ISBM",
@@ -93,12 +97,12 @@
"contactPhone": "6366970253",
"customerTiAcc": "ALPL01IA2INT",
"lstServerPort": "4001",
"active": false,
"serverLoc": "E:\\LST\\lstv2",
"oldVersion": "E:\\LST\\lst_backend_2",
"active": true,
"serverLoc": "D:\\LST\\lstv2_2",
"oldVersion": "D:\\LST\\lst_backend_2",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{ "specialInstructions": "something for ti" }]
"otherSettings": [{ "specialInstructions": "" }]
},
{
"sName": "Kansas City",
@@ -113,12 +117,12 @@
"contactPhone": "6366970253",
"customerTiAcc": "ALPL01KCINT",
"lstServerPort": "4000",
"active": false,
"active": true,
"serverLoc": "E:\\LST\\lstv2",
"oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{ "specialInstructions": "something for ti" }]
"otherSettings": [{ "specialInstructions": "" }]
},
{
"sName": "Bowling Green 2",
@@ -138,7 +142,7 @@
"oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{ "specialInstructions": "something for ti" }]
"otherSettings": [{ "specialInstructions": "" }]
},
{
"sName": "MCDonough",
@@ -158,7 +162,7 @@
"oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{ "specialInstructions": "something for ti" }]
"otherSettings": [{ "specialInstructions": "" }]
},
{
"sName": "Dayton",
@@ -178,7 +182,7 @@
"oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{ "specialInstructions": "something for ti" }]
"otherSettings": [{ "specialInstructions": "" }]
},
{
"sName": "Salt Lake City",
@@ -189,16 +193,16 @@
"streetAddress": "4324 Commercial Way Suite A",
"cityState": "Salt Lake City, UT",
"zipcode": "84104",
"contactEmail": "blake.matthes@alpla.com",
"contactPhone": "6366970253",
"contactEmail": "ShippingReceivingSaltLake@groups.alpla.com",
"contactPhone": "801-673-2143",
"customerTiAcc": "ALPL01SLCINT",
"lstServerPort": "4000",
"active": false,
"active": true,
"serverLoc": "E:\\LST\\lstv2",
"oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"shippingHours": "[{\"early\": \"07:00\", \"late\": \"17:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{ "specialInstructions": "something for ti" }]
"otherSettings": [{ "specialInstructions": "Copy of bol" }]
},
{
"sName": "Lima",
@@ -218,7 +222,7 @@
"oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{ "specialInstructions": "something for ti" }]
"otherSettings": [{ "specialInstructions": "" }]
},
{
"sName": "Florence",
@@ -233,12 +237,12 @@
"contactPhone": "6366970253",
"customerTiAcc": "ALPL01FLORINT",
"lstServerPort": "4000",
"active": false,
"active": true,
"serverLoc": "E:\\LST\\lstv2",
"oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{ "specialInstructions": "something for ti" }]
"otherSettings": [{ "specialInstructions": "" }]
},
{
"sName": "Iowa EBM",
@@ -253,12 +257,12 @@
"contactPhone": "6366970253",
"customerTiAcc": "ALPL01IA1INT",
"lstServerPort": "4000",
"active": false,
"serverLoc": "E:\\LST\\lstv2",
"oldVersion": "E:\\LST\\lst_backend",
"active": true,
"serverLoc": "D:\\LST\\lstv2",
"oldVersion": "D:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{ "specialInstructions": "something for ti" }]
"otherSettings": [{ "specialInstructions": "" }]
},
{
"sName": "Jefferson city",
@@ -278,7 +282,7 @@
"oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{ "specialInstructions": "something for ti" }]
"otherSettings": [{ "specialInstructions": "" }]
},
{
"sName": "Sherman",
@@ -298,7 +302,7 @@
"oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{ "specialInstructions": "something for ti" }]
"otherSettings": [{ "specialInstructions": "" }]
},
{
"sName": "West Bend",
@@ -313,13 +317,16 @@
"contactPhone": "262-808-4211",
"customerTiAcc": "ALPL01WBINT",
"lstServerPort": "4000",
"active": false,
"active": true,
"serverLoc": "E:\\LST\\lstv2",
"oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [
{ "specialInstructions": "something for ti", "active": false }
{
"specialInstructions": "This is a FTL load. The driver will need 2 adjustable load locks to secure the load. The driver will not be loaded without them. Please reference ALPLA pickup [header]",
"active": false
}
]
},
{
@@ -335,12 +342,12 @@
"contactPhone": "6366970253",
"customerTiAcc": "ALPL01STPINT",
"lstServerPort": "4000",
"active": false,
"active": true,
"serverLoc": "E:\\LST\\lstv2",
"oldVersion": "E:\\LST\\lst_backend",
"shippingHours": "[{\"early\": \"06:30\", \"late\": \"23:00\"}]",
"tiPostTime": "[{\"from\": \"24\", \"to\": \"24\"}]",
"otherSettings": [{ "specialInstructions": "something for ti" }]
"otherSettings": [{ "specialInstructions": "" }]
}
]
}

View File

@@ -1,9 +1,9 @@
// This will help maintain the server db so when we run an update it will show up here all the time.
// kinda bad too but this will help us keep the db identical.
import {db} from "../../../../database/dbclient.js";
import {serverData} from "../../../../database/schema/serverData.js";
import {createLog} from "../../logger/logger.js";
import { db } from "../../../../database/dbclient.js";
import { serverData } from "../../../../database/schema/serverData.js";
import { createLog } from "../../logger/logger.js";
import fs from "fs";
export const serversCheckPoint = async () => {
@@ -28,27 +28,38 @@ export const serversCheckPoint = async () => {
try {
for (let i = 0; i < servers.length; i++) {
const serverUpdate = await db
.insert(serverData)
.values(servers[i])
.onConflictDoUpdate({
target: serverData.plantToken,
set: {
sName: servers[i].sName,
serverDNS: servers[i].serverDNS,
active: servers[i].active,
contactEmail: servers[i].contactEmail,
contactPhone: servers[i].contactPhone,
shippingHours: servers[i].shippingHours,
customerTiAcc: servers[i].customerTiAcc,
oldVersion: servers[i].oldVersion,
tiPostTime: servers[i].tiPostTime,
otherSettings: servers[i].otherSettings,
},
}) // this will only update the ones that are new :D
.returning({name: serverData.sName});
.insert(serverData)
.values(servers[i])
.onConflictDoUpdate({
target: serverData.plantToken,
set: {
sName: servers[i].sName,
serverDNS: servers[i].serverDNS,
active: servers[i].active,
contactEmail: servers[i].contactEmail,
contactPhone: servers[i].contactPhone,
shippingHours: servers[i].shippingHours,
customerTiAcc: servers[i].customerTiAcc,
serverLoc: servers[i].serverLoc,
oldVersion: servers[i].oldVersion,
tiPostTime: servers[i].tiPostTime,
otherSettings: servers[i].otherSettings,
},
}) // this will only update the ones that are new :D
.returning({ name: serverData.sName });
}
createLog("info", "lst", "server", "Servers were just added/updated due to server startup");
createLog(
"info",
"lst",
"server",
"Servers were just added/updated due to server startup"
);
} catch (error) {
createLog("error", "lst", "server", `There was an error adding/updating serverData to the db, ${error}`);
createLog(
"error",
"lst",
"server",
`There was an error adding/updating serverData to the db, ${error}`
);
}
};