fix(datamart): added some fixed some
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user