feat(ocme): added in shipment data with increased checked

This commit is contained in:
2025-03-13 15:41:21 -05:00
parent d95b81d303
commit c386c5ea8b
4 changed files with 242 additions and 2 deletions

View File

@@ -1,5 +1,6 @@
import {createRoute, OpenAPIHono, z} from "@hono/zod-openapi";
import {apiHit} from "../../../globalUtils/apiHits.js";
import {getShipmentPallets} from "../controller/getShipmentPallets.js";
const app = new OpenAPIHono();
@@ -72,9 +73,19 @@ app.openapi(
const data = await c.req.json();
apiHit(c, {endpoint: "api/ocme/getshipmentpallets", lastBody: data});
const postPallet = {success: true, message: "Something", data: []};
if (!data.shipmentID) {
return c.json(
{success: false, message: "You are missing the shipment id please try again.", data: []},
400
);
}
return c.json({success: postPallet.success, message: postPallet.message, data: postPallet.data ?? []}, 200);
const shiptmentData = await getShipmentPallets(data.shipmentID);
return c.json(
{success: shiptmentData.success, message: shiptmentData.message, data: shiptmentData.data ?? []},
200
);
} catch (error) {
return c.json({success: false, message: "There was an error getting the shipment data.", data: error}, 400);
}