IO-233 Resolv merge issues & move allocations to ws

This commit is contained in:
Patrick Fic
2021-08-10 14:30:08 -07:00
parent e78e628bec
commit 6b64499e24
9 changed files with 431 additions and 104 deletions

View File

@@ -9,6 +9,8 @@ require("dotenv").config({
const { io } = require("../../server");
const { admin } = require("../firebase/firebase-handler");
const CdkJobExport = require("../cdk/cdk-job-export").default;
const CdkCalculateAllocations =
require("../cdk/cdk-calculate-allocations").default;
const { isArray } = require("lodash");
const logger = require("../utils/logger");
@@ -60,6 +62,18 @@ io.on("connection", (socket) => {
//CdkJobExport(socket, jobid);
});
socket.on("cdk-calculate-allocations", async (jobid, callback) => {
const allocations = await CdkCalculateAllocations(socket, jobid);
createLogEvent(socket, "DEBUG", `Allocations calculated.`);
createLogEvent(
socket,
"TRACE",
`Allocations calculated. ${JSON.stringify(allocations, null, 2)}`
);
callback(allocations);
});
socket.on("disconnect", () => {
createLogEvent(socket, "DEBUG", `User disconnected.`);
});