feat(ocme): added in shipment data with increased checked
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user