fix(lots errors): fixes to prevent crashes when sql server not connected

This commit is contained in:
2025-04-17 18:40:35 -05:00
parent e7e35336f8
commit d5114ba243
5 changed files with 201 additions and 195 deletions

View File

@@ -2,7 +2,6 @@
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 });
@@ -15,7 +14,7 @@ app.openapi(
path: "/getlots",
responses: responses(),
}),
async (c) => {
async (c: any) => {
const { data: lotData, error: lotError } = await tryCatch(getLots());
if (lotError) {
@@ -26,9 +25,9 @@ app.openapi(
}
return c.json({
success: lotData.success,
message: lotData.message,
data: lotData.data,
success: lotData?.success,
message: lotData?.message,
data: lotData?.data,
});
}
);