feat(missing inv): adding a way to check for missing data in case it dose pull on the correct days
This commit is contained in:
@@ -5,45 +5,45 @@ import { historicalInvByDate } from "../controller/getHistoricalInvByDate.js";
|
||||
|
||||
const app = new OpenAPIHono({ strict: false });
|
||||
const EomStat = z.object({
|
||||
plant: z.string().openapi({ example: "Salt Lake City" }),
|
||||
userRan: z.string().openapi({ example: "smith034" }),
|
||||
eomSheetVersion: z.string().openapi({ example: "0.0.223" }),
|
||||
plant: z.string().openapi({ example: "Salt Lake City" }),
|
||||
userRan: z.string().openapi({ example: "smith034" }),
|
||||
eomSheetVersion: z.string().openapi({ example: "0.0.223" }),
|
||||
});
|
||||
|
||||
app.openapi(
|
||||
createRoute({
|
||||
tags: ["eom"],
|
||||
summary: "Gets History Data by date.",
|
||||
method: "get",
|
||||
path: "/histinv",
|
||||
responses: responses(),
|
||||
}),
|
||||
async (c) => {
|
||||
//const body = await c.req.json();
|
||||
// make sure we have a vaid user being accessed thats really logged in
|
||||
const q: any = c.req.queries();
|
||||
createRoute({
|
||||
tags: ["eom"],
|
||||
summary: "Gets History Data by date.",
|
||||
method: "get",
|
||||
path: "/histinv",
|
||||
responses: responses(),
|
||||
}),
|
||||
async (c) => {
|
||||
//const body = await c.req.json();
|
||||
// make sure we have a vaid user being accessed thats really logged in
|
||||
const q: any = c.req.queries();
|
||||
|
||||
apiHit(c, { endpoint: "/histinv" });
|
||||
try {
|
||||
const res = await historicalInvByDate(
|
||||
q["month"] ? q["month"][0] : null,
|
||||
q["includePlantToken"] ? true : false
|
||||
);
|
||||
apiHit(c, { endpoint: "/histinv" });
|
||||
try {
|
||||
const res = await historicalInvByDate(
|
||||
q["month"] ? q["month"][0] : null,
|
||||
q["includePlantToken"] ? true : false,
|
||||
);
|
||||
|
||||
return c.json(
|
||||
{ success: res.success, message: res.message, data: res.data },
|
||||
200
|
||||
);
|
||||
} catch (error) {
|
||||
return c.json(
|
||||
{
|
||||
success: false,
|
||||
message: "There was an error posting the eom stat.",
|
||||
data: error,
|
||||
},
|
||||
400
|
||||
);
|
||||
}
|
||||
}
|
||||
return c.json(
|
||||
{ success: res.success, message: res.message, data: res.data },
|
||||
200,
|
||||
);
|
||||
} catch (error) {
|
||||
return c.json(
|
||||
{
|
||||
success: false,
|
||||
message: "There was an error getting the eom data.",
|
||||
data: error,
|
||||
},
|
||||
400,
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
export default app;
|
||||
|
||||
Reference in New Issue
Block a user