feat(datamart): new query to check if the city state will be valid to process in tms
This commit is contained in:
50
server/services/dataMart/route/getCityStateData.ts
Normal file
50
server/services/dataMart/route/getCityStateData.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { createRoute, OpenAPIHono, z } from "@hono/zod-openapi";
|
||||
import { responses } from "../../../globalUtils/routeDefs/responses.js";
|
||||
import { tryCatch } from "../../../globalUtils/tryCatch.js";
|
||||
import { getINV } from "../controller/getinventory.js";
|
||||
import { apiHit } from "../../../globalUtils/apiHits.js";
|
||||
import { validateCS } from "../controller/validateCityState.js";
|
||||
|
||||
const app = new OpenAPIHono({ strict: false });
|
||||
const Body = z.object({
|
||||
includeRunnningNumbers: z.string().openapi({ example: "x" }),
|
||||
});
|
||||
app.openapi(
|
||||
createRoute({
|
||||
tags: ["dataMart"],
|
||||
summary: "Returns Address with incorrect city state.",
|
||||
method: "get",
|
||||
path: "/getaddressdata",
|
||||
request: {
|
||||
body: {
|
||||
content: {
|
||||
"application/json": { schema: Body },
|
||||
},
|
||||
},
|
||||
},
|
||||
responses: responses(),
|
||||
}),
|
||||
async (c) => {
|
||||
// make sure we have a vaid user being accessed thats really logged in
|
||||
apiHit(c, { endpoint: "/getaddressdata" });
|
||||
const { data, error } = await tryCatch(validateCS());
|
||||
|
||||
if (error) {
|
||||
return c.json(
|
||||
{
|
||||
success: false,
|
||||
message: "There was an error getting address data.",
|
||||
data: error,
|
||||
},
|
||||
400
|
||||
);
|
||||
}
|
||||
|
||||
return c.json({
|
||||
success: data.success,
|
||||
message: data.message,
|
||||
data: data.data,
|
||||
});
|
||||
}
|
||||
);
|
||||
export default app;
|
||||
@@ -95,6 +95,14 @@ const current: any = [
|
||||
"Returns all open orders to correct and resubmit, leaving blank will get everything putting an address only returns the specified address",
|
||||
criteria: "address", // uncomment this out once the improt process can be faster
|
||||
},
|
||||
{
|
||||
name: "Address Corrections",
|
||||
endpoint: "/api/datamart/getaddressdata",
|
||||
// description: "Returns all inventory, by default excludes running numebrs, also excludes inv locations.",
|
||||
description:
|
||||
"Returns all addresses that will not process correctly in tms due to incorrect city state setup.",
|
||||
//criteria: "address", // uncomment this out once the improt process can be faster
|
||||
},
|
||||
];
|
||||
|
||||
app.openapi(
|
||||
|
||||
Reference in New Issue
Block a user