fix(lots errors): fixes to prevent crashes when sql server not connected
This commit is contained in:
@@ -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,
|
||||
});
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user