tango-app-api-audit 3.4.11-alpha.23 → 3.4.11-alpha.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1365,19 +1365,9 @@ export async function save( req, res ) {
|
|
|
1365
1365
|
};
|
|
1366
1366
|
await insertOpenSearchData( openSearch.auditLog, logData );
|
|
1367
1367
|
|
|
1368
|
-
let storeConfig = await findOneStore(
|
|
1369
|
-
{
|
|
1370
|
-
storeId: req.userAudit?.storeId,
|
|
1371
|
-
},
|
|
1372
|
-
{
|
|
1373
|
-
auditConfigs: 1,
|
|
1374
|
-
clientId: 1,
|
|
1375
|
-
},
|
|
1376
|
-
);
|
|
1377
|
-
|
|
1378
1368
|
let clientData = await findClient( { clientId: req.userAudit?.clientId } );
|
|
1379
1369
|
const ratio = ( ( storeAuditData.beforeCount - inputData.customerCount ) / storeAuditData.beforeCount );
|
|
1380
|
-
if ( ratio <
|
|
1370
|
+
if ( ratio < clientData[0].auditConfigs.ratio &&
|
|
1381
1371
|
inputData.auditType == 'Audit' &&
|
|
1382
1372
|
inputData.moduleType == 'traffic'
|
|
1383
1373
|
) {
|
|
@@ -4535,39 +4535,42 @@ export async function save( req, res ) {
|
|
|
4535
4535
|
if ( !getFilePath ) {
|
|
4536
4536
|
return res.sendError( ' SQS is not sent due to Inserted Data is not there', 400 );
|
|
4537
4537
|
}
|
|
4538
|
+
const [ getStore, getClient ] = await Promise.all( [ findOneStore( { storeId: inputData.storeId }, { storeName: 1, storeProfile: 1, spocDetails: 1 } ), findOneClient( { clientId: inputData.clientId }, { clientName: 1 } ) ] );
|
|
4539
|
+
|
|
4538
4540
|
const tempId=[];
|
|
4539
4541
|
if ( inputData.employeeCount > 0 ) {
|
|
4540
4542
|
for ( let i =0; i<inputData?.employee.length; i++ ) {
|
|
4541
4543
|
tempId.push( inputData?.employee[i].img_id );
|
|
4542
4544
|
}
|
|
4543
|
-
}
|
|
4544
|
-
const [ getStore, getClient ] = await Promise.all( [ findOneStore( { storeId: inputData.storeId }, { storeName: 1, storeProfile: 1, spocDetails: 1 } ), findOneClient( { clientId: inputData.clientId }, { clientName: 1 } ) ] );
|
|
4545
|
-
const sqsProduceQueue = {
|
|
4546
|
-
QueueUrl: `${sqs.url}${sqs.uniformOutput}`,
|
|
4547
|
-
MessageBody: JSON.stringify( {
|
|
4548
|
-
storeId: inputData.storeId,
|
|
4549
|
-
storeName: getStore?.storeName,
|
|
4550
|
-
fileDate: inputData.fileDate,
|
|
4551
|
-
moduleType: inputData.moduleType,
|
|
4552
|
-
inputBucketName: getFilePath?.sqs?.Body?.inputBucketName,
|
|
4553
|
-
tempId: tempId,
|
|
4554
|
-
count: inputData.employeeCount,
|
|
4555
|
-
folderPath: getFilePath?.sqs?.Body?.folderPath,
|
|
4556
|
-
} ),
|
|
4557
|
-
};
|
|
4558
|
-
const sqsQueue = await sendMessageToQueue(
|
|
4559
|
-
sqsProduceQueue.QueueUrl,
|
|
4560
|
-
sqsProduceQueue.MessageBody,
|
|
4561
|
-
);
|
|
4562
4545
|
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4568
|
-
|
|
4546
|
+
const sqsProduceQueue = {
|
|
4547
|
+
QueueUrl: `${sqs.url}${sqs.uniformOutput}`,
|
|
4548
|
+
MessageBody: JSON.stringify( {
|
|
4549
|
+
storeId: inputData.storeId,
|
|
4550
|
+
storeName: getStore?.storeName,
|
|
4551
|
+
fileDate: inputData.fileDate,
|
|
4552
|
+
moduleType: inputData.moduleType,
|
|
4553
|
+
inputBucketName: getFilePath?.sqs?.Body?.inputBucketName,
|
|
4554
|
+
tempId: tempId,
|
|
4555
|
+
count: inputData.employeeCount,
|
|
4556
|
+
folderPath: getFilePath?.sqs?.Body?.folderPath,
|
|
4557
|
+
} ),
|
|
4558
|
+
};
|
|
4559
|
+
const sqsQueue = await sendMessageToQueue(
|
|
4560
|
+
sqsProduceQueue.QueueUrl,
|
|
4561
|
+
sqsProduceQueue.MessageBody,
|
|
4562
|
+
);
|
|
4563
|
+
|
|
4564
|
+
if ( sqsQueue.statusCode ) {
|
|
4565
|
+
logger.error( {
|
|
4566
|
+
error: `${sqsQueue}`,
|
|
4567
|
+
type: 'UPLOAD_ERROR',
|
|
4568
|
+
} );
|
|
4569
|
+
return res.sendError( 'SQS not sent', 500 );
|
|
4570
|
+
}
|
|
4569
4571
|
}
|
|
4570
4572
|
|
|
4573
|
+
|
|
4571
4574
|
// trax output in open serach
|
|
4572
4575
|
const output = {
|
|
4573
4576
|
clientId: inputData.clientId,
|