feat(lstv2 move): moved lstv2 into this app to keep them combined and easier to maintain
This commit is contained in:
57
lstV2/server/services/logistics/route/getActiveLanes.ts
Normal file
57
lstV2/server/services/logistics/route/getActiveLanes.ts
Normal file
@@ -0,0 +1,57 @@
|
||||
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
|
||||
import { responses } from "../../../globalUtils/routeDefs/responses.js";
|
||||
import { tryCatch } from "../../../globalUtils/tryCatch.js";
|
||||
import { getCycleCountCheck } from "../controller/warehouse/cycleCountChecks/getCycleCountCheck.js";
|
||||
import { getPPOO } from "../controller/warehouse/ppoo/getPPOO.js";
|
||||
import { apiHit } from "../../../globalUtils/apiHits.js";
|
||||
import { getActiveWarehouseLanes } from "../controller/warehouse/activeWarehouseLanes.js";
|
||||
|
||||
const app = new OpenAPIHono();
|
||||
|
||||
// const Body = z
|
||||
// .object({
|
||||
// age: z.number().optional().openapi({ example: 90 }),
|
||||
// //email: z.string().optional().openapi({example: "s.smith@example.com"}),
|
||||
// type: z.string().optional().openapi({ example: "fg" }),
|
||||
// })
|
||||
// .openapi("User");
|
||||
app.openapi(
|
||||
createRoute({
|
||||
tags: ["logistics"],
|
||||
summary: "Returns current active lanes",
|
||||
method: "get",
|
||||
path: "/getactivelanes",
|
||||
// request: {
|
||||
// body: {
|
||||
// content: {
|
||||
// "application/json": { schema: Body },
|
||||
// },
|
||||
// },
|
||||
// },
|
||||
// description:
|
||||
// "Provided a running number and lot number you can consume material.",
|
||||
responses: responses(),
|
||||
}),
|
||||
async (c: any) => {
|
||||
apiHit(c, { endpoint: "/getactivelanes" });
|
||||
|
||||
const { data: lanes, error } = await tryCatch(
|
||||
getActiveWarehouseLanes()
|
||||
);
|
||||
|
||||
if (error) {
|
||||
return c.json({
|
||||
success: false,
|
||||
message: "Error getting lane data.",
|
||||
data: error,
|
||||
});
|
||||
}
|
||||
|
||||
return c.json({
|
||||
success: lanes.success,
|
||||
message: lanes.message,
|
||||
data: lanes.data,
|
||||
});
|
||||
}
|
||||
);
|
||||
export default app;
|
||||
Reference in New Issue
Block a user