IO-233 CDK Reformatting. First successful post.

This commit is contained in:
Patrick Fic
2021-09-10 14:58:09 -07:00
parent 22e30ae5cb
commit fe993cba73
14 changed files with 1101 additions and 382 deletions

View File

@@ -8,14 +8,11 @@ require("dotenv").config({
const GraphQLClient = require("graphql-request").GraphQLClient;
const soap = require("soap");
const queries = require("../graphql-client/queries");
const CdkBase = require("../web-sockets/web-socket");
const CdkWsdl = require("./cdk-wsdl").default;
const logger = require("../utils/logger");
const Dinero = require("dinero.js");
const _ = require("lodash");
const { CDK_CREDENTIALS, CheckCdkResponseForError } = require("./cdk-wsdl");
const { performance } = require("perf_hooks");
const apiGqlClient = require("../graphql-client/graphql-client").client;
// exports.default = async function (socket, cdk_dealerid) {
// try {
@@ -87,6 +84,7 @@ exports.default = async function ReloadCdkMakes(req, res) {
count: newList.length,
}
);
res.sendStatus(200);
} catch (error) {
logger.log(
"cdk-replace-makes-models-error",
@@ -98,6 +96,7 @@ exports.default = async function ReloadCdkMakes(req, res) {
error,
}
);
res.status(500).json(error);
}
};
@@ -108,7 +107,7 @@ async function GetCdkMakes(req, cdk_dealerid) {
try {
const soapClientVehicleInsert = await soap.createClientAsync(
CdkWsdl.VehicleInsert
CdkWsdl.VehicleInsertUpdate
);
const soapResponseVehicleSearch =

View File

@@ -84,14 +84,6 @@ exports.default = async function (socket, { txEnvelope, jobid }) {
"ERROR",
`Error encountered in CdkJobExport. ${error}`
);
} finally {
//Ensure we always insert logEvents
//GQL to insert logevents.
CdkBase.createLogEvent(
socket,
"DEBUG",
`Capturing log events to database.`
);
}
};
@@ -183,6 +175,8 @@ async function CdkSelectedCustomer(socket, selectedCustomerId) {
);
await MarkJobExported(socket, socket.JobData.id);
socket.emit("export-success", socket.JobData.id);
} else {
//Get the error code
CdkBase.createLogEvent(
@@ -209,7 +203,7 @@ async function CdkSelectedCustomer(socket, selectedCustomerId) {
CdkBase.createLogEvent(
socket,
"ERROR",
`Error(s) encountered in posting transaction. ${e}`
r`Error(s) encountered in posting transaction. ${e}`
)
);
}
@@ -1224,7 +1218,11 @@ async function DeleteDmsWip(socket) {
}
async function MarkJobExported(socket, jobid) {
CdkBase.createLogEvent(socket, "DEBUG", `Querying job data for id ${jobid}`);
CdkBase.createLogEvent(
socket,
"DEBUG",
`Marking job as exported for id ${jobid}`
);
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
const result = await client
.setHeaders({ Authorization: `Bearer ${socket.handshake.auth.token}` })