feature/Reynolds-and-Reynolds-DMS-API-Integration -Expand
This commit is contained in:
@@ -44,6 +44,12 @@ const redisSocketEvents = ({
|
||||
socket.bodyshopId = bodyshopId;
|
||||
socket.data = socket.data || {};
|
||||
socket.data.authToken = token;
|
||||
|
||||
// Used to update legacy sockets
|
||||
if (socket.handshake?.auth) {
|
||||
socket.handshake.auth.token = token;
|
||||
socket.handshake.auth.bodyshopId = bodyshopId;
|
||||
}
|
||||
await addUserSocketMapping(user.email, socket.id, bodyshopId);
|
||||
next();
|
||||
} catch (error) {
|
||||
@@ -418,6 +424,38 @@ const redisSocketEvents = ({
|
||||
socket.on("rr-get-parts", async ({ jobid, params }, cb) => {
|
||||
// similar pattern using RrGetParts
|
||||
});
|
||||
|
||||
socket.on("rr-get-advisors", async ({ jobid, params }, cb) => {
|
||||
try {
|
||||
const { RrGetAdvisors } = require("../rr/rr-lookup");
|
||||
const data = await RrGetAdvisors({
|
||||
socket,
|
||||
redisHelpers: { setSessionTransactionData, getSessionTransactionData },
|
||||
jobid,
|
||||
params
|
||||
});
|
||||
cb?.(data);
|
||||
} catch (e) {
|
||||
RRLogger(socket, "error", `RR get advisors error: ${e.message}`);
|
||||
cb?.(null);
|
||||
}
|
||||
});
|
||||
|
||||
socket.on("rr-get-parts", async ({ jobid, params }, cb) => {
|
||||
try {
|
||||
const { RrGetParts } = require("../rr/rr-lookup");
|
||||
const data = await RrGetParts({
|
||||
socket,
|
||||
redisHelpers: { setSessionTransactionData, getSessionTransactionData },
|
||||
jobid,
|
||||
params
|
||||
});
|
||||
cb?.(data);
|
||||
} catch (e) {
|
||||
RRLogger(socket, "error", `RR get parts error: ${e.message}`);
|
||||
cb?.(null);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
// Call Handlers
|
||||
|
||||
Reference in New Issue
Block a user