feat(ocp): completly moved ocp to lst

This commit is contained in:
2025-04-06 07:48:05 -05:00
parent 95bebbde2b
commit 51cc4aa370
13 changed files with 448 additions and 96 deletions

View File

@@ -191,33 +191,45 @@ const newSettings = [
serviceBelowsTo: "system",
roleToChange: "admin",
},
// ocp
{
name: "acpActive",
value: `1`,
description: "Are we pritning on demand?",
serviceBelowsTo: "ocp",
roleToChange: "admin",
},
{
name: "ocpCycleDelay",
value: `10`,
description: "How long between printer cycles do we want to monitor.",
serviceBelowsTo: "ocp",
roleToChange: "admin",
},
];
export const areSettingsIn = async () => {
// get the roles
try {
const settingsCheck = await db.select().from(settings);
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",
"Settings 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"
);
}
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",
"Settings 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"
);
}
} catch (error) {
createLog(