Files
lstV2/server/services/ocp/routes/labeling/getLabelRatio.ts
Blake Matthes 41308788fd feat(labelratio): new feature to monitor label ratio from auto and manual
this was designed more for dayton but could be used for all plants
2025-07-14 10:18:23 -05:00

40 lines
1.2 KiB
TypeScript

// 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 { apiHit } from "../../../../globalUtils/apiHits.js";
import { getLabelRatio } from "../../controller/labeling/getLabelRatio.js";
const app = new OpenAPIHono({ strict: false });
app.openapi(
createRoute({
tags: ["ocp"],
summary: "Returns current active lots that are tech released",
method: "get",
path: "/labelratio",
responses: responses(),
}),
async (c) => {
const { data: labelData, error: labelError } = await tryCatch(
getLabelRatio()
);
apiHit(c, { endpoint: "/labelratio" });
if (labelError) {
return c.json({
success: false,
message: "There was an error getting the printers",
});
}
return c.json({
success: labelData.success,
message: labelData.message,
count: labelData.count,
data: labelData.data,
});
}
);
export default app;