feature/IO-2776-cdk-fortellis - Remove socket auth , was supposed to be old sockets.
This commit is contained in:
@@ -177,11 +177,9 @@ exports.PbsCalculateAllocationsAp = PbsCalculateAllocationsAp;
|
|||||||
async function QueryBillData(socket, billids) {
|
async function QueryBillData(socket, billids) {
|
||||||
WsLogger.createLogEvent(socket, "DEBUG", `Querying bill data for id(s) ${billids}`);
|
WsLogger.createLogEvent(socket, "DEBUG", `Querying bill data for id(s) ${billids}`);
|
||||||
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
|
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
|
||||||
const currentToken =
|
|
||||||
(socket?.data && socket.data.authToken) || (socket?.handshake?.auth && socket.handshake.auth.token);
|
|
||||||
|
|
||||||
const result = await client
|
const result = await client
|
||||||
.setHeaders({ Authorization: `Bearer ${currentToken}` })
|
.setHeaders({ Authorization: `Bearer ${socket.handshake.auth.token}` })
|
||||||
.request(queries.GET_PBS_AP_ALLOCATIONS, { billids: billids });
|
.request(queries.GET_PBS_AP_ALLOCATIONS, { billids: billids });
|
||||||
|
|
||||||
WsLogger.createLogEvent(socket, "SILLY", `Bill data query result ${JSON.stringify(result, null, 2)}`);
|
WsLogger.createLogEvent(socket, "SILLY", `Bill data query result ${JSON.stringify(result, null, 2)}`);
|
||||||
@@ -201,11 +199,9 @@ function getCostAccount(billline, respcenters) {
|
|||||||
async function MarkApExported(socket, billids) {
|
async function MarkApExported(socket, billids) {
|
||||||
WsLogger.createLogEvent(socket, "DEBUG", `Marking bills as exported for id ${billids}`);
|
WsLogger.createLogEvent(socket, "DEBUG", `Marking bills as exported for id ${billids}`);
|
||||||
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
|
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
|
||||||
const currentToken =
|
|
||||||
(socket?.data && socket.data.authToken) || (socket?.handshake?.auth && socket.handshake.auth.token);
|
|
||||||
|
|
||||||
const result = await client
|
const result = await client
|
||||||
.setHeaders({ Authorization: `Bearer ${currentToken}` })
|
.setHeaders({ Authorization: `Bearer ${socket.handshake.auth.token}` })
|
||||||
.request(queries.MARK_BILLS_EXPORTED, {
|
.request(queries.MARK_BILLS_EXPORTED, {
|
||||||
billids,
|
billids,
|
||||||
bill: {
|
bill: {
|
||||||
|
|||||||
@@ -126,11 +126,9 @@ exports.CheckForErrors = CheckForErrors;
|
|||||||
async function QueryJobData(socket, jobid) {
|
async function QueryJobData(socket, jobid) {
|
||||||
WsLogger.createLogEvent(socket, "DEBUG", `Querying job data for id ${jobid}`);
|
WsLogger.createLogEvent(socket, "DEBUG", `Querying job data for id ${jobid}`);
|
||||||
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
|
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
|
||||||
const currentToken =
|
|
||||||
(socket?.data && socket.data.authToken) || (socket?.handshake?.auth && socket.handshake.auth.token);
|
|
||||||
|
|
||||||
const result = await client
|
const result = await client
|
||||||
.setHeaders({ Authorization: `Bearer ${currentToken}` })
|
.setHeaders({ Authorization: `Bearer ${socket.handshake.auth.token}` })
|
||||||
.request(queries.QUERY_JOBS_FOR_PBS_EXPORT, { id: jobid });
|
.request(queries.QUERY_JOBS_FOR_PBS_EXPORT, { id: jobid });
|
||||||
|
|
||||||
WsLogger.createLogEvent(socket, "SILLY", `Job data query result ${JSON.stringify(result, null, 2)}`);
|
WsLogger.createLogEvent(socket, "SILLY", `Job data query result ${JSON.stringify(result, null, 2)}`);
|
||||||
@@ -581,11 +579,9 @@ async function InsertAccountPostingData(socket) {
|
|||||||
async function MarkJobExported(socket, jobid) {
|
async function MarkJobExported(socket, jobid) {
|
||||||
WsLogger.createLogEvent(socket, "DEBUG", `Marking job as exported for id ${jobid}`);
|
WsLogger.createLogEvent(socket, "DEBUG", `Marking job as exported for id ${jobid}`);
|
||||||
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
|
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
|
||||||
const currentToken =
|
|
||||||
(socket?.data && socket.data.authToken) || (socket?.handshake?.auth && socket.handshake.auth.token);
|
|
||||||
|
|
||||||
const result = await client
|
const result = await client
|
||||||
.setHeaders({ Authorization: `Bearer ${currentToken}` })
|
.setHeaders({ Authorization: `Bearer ${socket.handshake.auth.token}` })
|
||||||
.request(queries.MARK_JOB_EXPORTED, {
|
.request(queries.MARK_JOB_EXPORTED, {
|
||||||
jobId: jobid,
|
jobId: jobid,
|
||||||
job: {
|
job: {
|
||||||
@@ -611,11 +607,9 @@ async function MarkJobExported(socket, jobid) {
|
|||||||
async function InsertFailedExportLog(socket, error) {
|
async function InsertFailedExportLog(socket, error) {
|
||||||
try {
|
try {
|
||||||
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
|
const client = new GraphQLClient(process.env.GRAPHQL_ENDPOINT, {});
|
||||||
const currentToken =
|
|
||||||
(socket?.data && socket.data.authToken) || (socket?.handshake?.auth && socket.handshake.auth.token);
|
|
||||||
|
|
||||||
const result = await client
|
const result = await client
|
||||||
.setHeaders({ Authorization: `Bearer ${currentToken}` })
|
.setHeaders({ Authorization: `Bearer ${socket.handshake.auth.token}` })
|
||||||
.request(queries.INSERT_EXPORT_LOG, {
|
.request(queries.INSERT_EXPORT_LOG, {
|
||||||
log: {
|
log: {
|
||||||
bodyshopid: socket.JobData.bodyshop.id,
|
bodyshopid: socket.JobData.bodyshop.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user