feat(lstv2 move): moved lstv2 into this app to keep them combined and easier to maintain
This commit is contained in:
35
lstV2/server/services/quality/route/getRequest.ts
Normal file
35
lstV2/server/services/quality/route/getRequest.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
// an external way to creating logs
|
||||
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
|
||||
import { responses } from "../../../globalUtils/routeDefs/responses.js";
|
||||
import { getRequest } from "../controller/getRequests.js";
|
||||
import { tryCatch } from "../../../globalUtils/tryCatch.js";
|
||||
import { apiHit } from "../../../globalUtils/apiHits.js";
|
||||
|
||||
const app = new OpenAPIHono({ strict: false });
|
||||
|
||||
app.openapi(
|
||||
createRoute({
|
||||
tags: ["quality"],
|
||||
summary: "Returns all pallets requested",
|
||||
method: "get",
|
||||
path: "/getrequest",
|
||||
responses: responses(),
|
||||
}),
|
||||
async (c) => {
|
||||
const { data, error } = await tryCatch(getRequest());
|
||||
apiHit(c, { endpoint: "/getrequest" });
|
||||
if (error) {
|
||||
return c.json({
|
||||
success: false,
|
||||
message: "There was an error getting the printers",
|
||||
});
|
||||
}
|
||||
|
||||
return c.json({
|
||||
success: data.success,
|
||||
message: data.message,
|
||||
data: data.data,
|
||||
});
|
||||
}
|
||||
);
|
||||
export default app;
|
||||
Reference in New Issue
Block a user