feat(labeling): ratios reset for labeling implemeneted

This commit is contained in:
2025-07-14 12:37:38 -05:00
parent a7f8e39bac
commit 61f0b7f06b
11 changed files with 340 additions and 8 deletions

View File

@@ -0,0 +1,38 @@
// 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";
import { resetLabelRatio } from "../../controller/labeling/labelRatio.js";
const app = new OpenAPIHono({ strict: false });
app.openapi(
createRoute({
tags: ["ocp"],
summary: "Resets the label Ratio",
method: "post",
path: "/resetlabelratio",
responses: responses(),
}),
async (c) => {
const { data: labelData, error: labelError } = await tryCatch(
resetLabelRatio()
);
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,
});
}
);
export default app;