feat(lstv2 move): moved lstv2 into this app to keep them combined and easier to maintain

This commit is contained in:
2025-09-19 22:22:05 -05:00
parent caf2315191
commit e4477402ad
847 changed files with 165801 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
// an external way to creating logs
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
import { authMiddleware } from "../../../auth/middleware/authMiddleware.js";
import { responses } from "../../../../globalUtils/routeDefs/responses.js";
import { tryCatch } from "../../../../globalUtils/tryCatch.js";
import { printerCycle } from "../../controller/printers/printerCycle.js";
import { apiHit } from "../../../../globalUtils/apiHits.js";
const app = new OpenAPIHono({ strict: false });
app.openapi(
createRoute({
tags: ["ocp:printers"],
summary: "starts the printers cycling.",
method: "get",
path: "/startsprintercycle",
middleware: authMiddleware,
//description: "This might be a temp soltuin during the transtion between versions",
// request: {
// body: {content: {"application/json": {schema: CreateLog}}},
// },
responses: responses(),
}),
async (c) => {
const { data, error } = await tryCatch(printerCycle());
apiHit(c, { endpoint: "/startsprintercycle" });
const dataError: any = error;
if (error) {
return c.json({
success: false,
message: "Error in stopping the printer cycle",
data: dataError?.data,
});
}
const getData: any = data;
return c.json({
success: getData?.success,
message: getData?.message,
data: getData.data ?? [],
});
}
);
export default app;

View File

@@ -0,0 +1,43 @@
// an external way to creating logs
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
import { authMiddleware } from "../../../auth/middleware/authMiddleware.js";
import { responses } from "../../../../globalUtils/routeDefs/responses.js";
import { tryCatch } from "../../../../globalUtils/tryCatch.js";
import { stopPrinterCycle } from "../../controller/printers/printerCycle.js";
import { apiHit } from "../../../../globalUtils/apiHits.js";
const app = new OpenAPIHono({ strict: false });
app.openapi(
createRoute({
tags: ["ocp:printers"],
summary: "Stops the printers cycling.",
method: "get",
path: "/stopprintercycle",
middleware: authMiddleware,
//description: "This might be a temp soltuin during the transtion between versions",
// request: {
// body: {content: {"application/json": {schema: CreateLog}}},
// },
responses: responses(),
}),
async (c) => {
const { data, error } = await tryCatch(stopPrinterCycle());
apiHit(c, { endpoint: "/stopprintercycle" });
const dataError: any = error;
if (error) {
return c.json({
success: false,
message: "Error in stopping the printer cycle",
data: dataError?.data,
});
}
const getData: any = data;
return c.json({
success: getData?.success,
message: getData?.message,
data: getData.data ?? [],
});
}
);
export default app;

View File

@@ -0,0 +1,52 @@
// an external way to creating logs
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
import { responses } from "../../../../globalUtils/routeDefs/responses.js";
import { tryCatch } from "../../../../globalUtils/tryCatch.js";
import { getPrinters } from "../../controller/printers/getPrinters.js";
import { apiHit } from "../../../../globalUtils/apiHits.js";
const app = new OpenAPIHono({ strict: false });
const CreateLog = z.object({
line: z.string().openapi({ example: "info" }),
initials: z.string().openapi({ example: "server" }),
printReason: z.string().openapi({ example: "This is a new log posted" }),
additionalComments: z
.string()
.optional()
.openapi({ example: "Some reason why we did this." }),
});
app.openapi(
createRoute({
tags: ["ocp"],
summary: "Prints a label.",
method: "get",
path: "/getprinters",
//middleware: authMiddleware,
//description: "This might be a temp soltuin during the transtion between versions",
request: {
body: { content: { "application/json": { schema: CreateLog } } },
},
responses: responses(),
}),
async (c) => {
const { data: printData, error: printError } = await tryCatch(
getPrinters()
);
apiHit(c, { endpoint: "/getprinters" });
if (printError) {
return c.json({
success: false,
message: "There was an error getting the printers",
});
}
return c.json({
success: printData.success,
message: printData.message,
data: printData.data,
});
}
);
export default app;

View File

@@ -0,0 +1,43 @@
// an external way to creating logs
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
import { authMiddleware } from "../../../auth/middleware/authMiddleware.js";
import { responses } from "../../../../globalUtils/routeDefs/responses.js";
import { tryCatch } from "../../../../globalUtils/tryCatch.js";
import { printerCycle } from "../../controller/printers/printerCycle.js";
import { apiHit } from "../../../../globalUtils/apiHits.js";
const app = new OpenAPIHono({ strict: false });
app.openapi(
createRoute({
tags: ["ocp:printers"],
summary: "starts the printers cycling.",
method: "get",
path: "/startsprintercycle",
middleware: authMiddleware,
//description: "This might be a temp soltuin during the transtion between versions",
// request: {
// body: {content: {"application/json": {schema: CreateLog}}},
// },
responses: responses(),
}),
async (c) => {
const { data, error } = await tryCatch(printerCycle());
apiHit(c, { endpoint: "/startsprintercycle" });
const dataError: any = error;
if (error) {
return c.json({
success: false,
message: "Error in stopping the printer cycle",
data: dataError?.data,
});
}
const getData: any = data;
return c.json({
success: getData?.success,
message: getData?.message,
data: getData.data ?? [],
});
}
);
export default app;

View File

@@ -0,0 +1,43 @@
// an external way to creating logs
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
import { authMiddleware } from "../../../auth/middleware/authMiddleware.js";
import { responses } from "../../../../globalUtils/routeDefs/responses.js";
import { tryCatch } from "../../../../globalUtils/tryCatch.js";
import { stopPrinterCycle } from "../../controller/printers/printerCycle.js";
import { apiHit } from "../../../../globalUtils/apiHits.js";
const app = new OpenAPIHono({ strict: false });
app.openapi(
createRoute({
tags: ["ocp:printers"],
summary: "Stops the printers cycling.",
method: "get",
path: "/stopprintercycle",
middleware: authMiddleware,
//description: "This might be a temp soltuin during the transtion between versions",
// request: {
// body: {content: {"application/json": {schema: CreateLog}}},
// },
responses: responses(),
}),
async (c) => {
const { data, error } = await tryCatch(stopPrinterCycle());
apiHit(c, { endpoint: "/stopprintercycle" });
const dataError: any = error;
if (error) {
return c.json({
success: false,
message: "Error in stopping the printer cycle",
data: dataError?.data,
});
}
const getData: any = data;
return c.json({
success: getData?.success,
message: getData?.message,
data: getData.data ?? [],
});
}
);
export default app;

View File

@@ -0,0 +1,52 @@
// an external way to creating logs
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
import { responses } from "../../../../globalUtils/routeDefs/responses.js";
import { tryCatch } from "../../../../globalUtils/tryCatch.js";
import { updatePrinters } from "../../controller/printers/updatePrinters.js";
import { apiHit } from "../../../../globalUtils/apiHits.js";
const app = new OpenAPIHono({ strict: false });
const CreateLog = z.object({
line: z.string().openapi({ example: "info" }),
initials: z.string().openapi({ example: "server" }),
printReason: z.string().openapi({ example: "This is a new log posted" }),
additionalComments: z
.string()
.optional()
.openapi({ example: "Some reason why we did this." }),
});
app.openapi(
createRoute({
tags: ["ocp"],
summary: "Prints a label.",
method: "get",
path: "/updateprinters",
//middleware: authMiddleware,
//description: "This might be a temp soltuin during the transtion between versions",
request: {
body: { content: { "application/json": { schema: CreateLog } } },
},
responses: responses(),
}),
async (c) => {
const { data: printData, error: printError } = await tryCatch(
updatePrinters()
);
apiHit(c, { endpoint: "/updateprinters" });
if (printError) {
return c.json({
success: false,
message: "There was an error getting the printers",
});
}
return c.json({
success: printData.success,
message: printData.message,
data: printData.data,
});
}
);
export default app;