33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
// an external way to creating logs
|
|
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
|
|
import { responses } from "../../../globalUtils/routeDefs/responses.js";
|
|
|
|
import { apiHit } from "../../../globalUtils/apiHits.js";
|
|
import { getAllLogisticsJobs } from "../utils/logisticsIntervals.js";
|
|
|
|
const app = new OpenAPIHono({ strict: false });
|
|
|
|
app.openapi(
|
|
createRoute({
|
|
tags: ["logistics"],
|
|
summary: "Returns current active logistics intervals.",
|
|
method: "get",
|
|
path: "/activelogistics",
|
|
//middleware: authMiddleware,
|
|
responses: responses(),
|
|
}),
|
|
async (c) => {
|
|
apiHit(c, { endpoint: "/activelogistics" });
|
|
const jobs = getAllLogisticsJobs();
|
|
return c.json({
|
|
success: true,
|
|
message:
|
|
jobs.length === 0
|
|
? "There are no active logistics intervals Currently."
|
|
: "Current Active logistics intervals",
|
|
data: jobs,
|
|
});
|
|
}
|
|
);
|
|
export default app;
|