feat(ocp): add lots with scroll view was added
This commit is contained in:
35
server/services/ocp/routes/lots/getLots.ts
Normal file
35
server/services/ocp/routes/lots/getLots.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 { tryCatch } from "../../../../globalUtils/tryCatch.js";
|
||||
import { getPrinters } from "../../controller/printers/getPrinters.js";
|
||||
import { getLots } from "../../controller/lots/lots.js";
|
||||
|
||||
const app = new OpenAPIHono({ strict: false });
|
||||
|
||||
app.openapi(
|
||||
createRoute({
|
||||
tags: ["ocp"],
|
||||
summary: "Returns current active lots that are tech released",
|
||||
method: "get",
|
||||
path: "/getlots",
|
||||
responses: responses(),
|
||||
}),
|
||||
async (c) => {
|
||||
const { data: lotData, error: lotError } = await tryCatch(getLots());
|
||||
|
||||
if (lotError) {
|
||||
return c.json({
|
||||
success: false,
|
||||
message: "There was an error getting the printers",
|
||||
});
|
||||
}
|
||||
|
||||
return c.json({
|
||||
success: lotData.success,
|
||||
message: lotData.message,
|
||||
data: lotData.data,
|
||||
});
|
||||
}
|
||||
);
|
||||
export default app;
|
||||
Reference in New Issue
Block a user