fix(datamart): added some fixed some

This commit is contained in:
2025-04-04 17:11:32 -05:00
parent 8b5698a839
commit 5eacbb5ecf
9 changed files with 331 additions and 39 deletions

View File

@@ -4,34 +4,33 @@ import { tryCatch } from "../../../globalUtils/tryCatch.js";
import { getINV } from "../controller/getinventory.js";
const app = new OpenAPIHono({ strict: false });
const Body = z.object({
includeRunnningNumbers: z.string().openapi({ example: "x" }),
});
app.openapi(
createRoute({
tags: ["dataMart"],
summary: "Returns All current inventory.",
method: "get",
path: "/getinventory",
// request: {
// body: {
// content: {
// "application/json": { schema: Body },
// },
// },
// },
request: {
body: {
content: {
"application/json": { schema: Body },
},
},
},
responses: responses(),
}),
async (c) => {
// const { data: body, error } = await c.req.json();
const includeRunnningNumbers: string =
c.req.query("includeRunnningNumbers") ?? "";
// if (error) {
// return c.json({
// success: false,
// message: "Missing data please try again.",
// });
// }
// make sure we have a vaid user being accessed thats really logged in
//apiHit(c, { endpoint: `api/logger/logs/id` });
const { data, error } = await tryCatch(getINV());
const { data, error } = await tryCatch(
getINV(includeRunnningNumbers?.length > 0 ? true : false)
);
if (error) {
return c.json(