tango-app-api-audit 3.4.47 → 3.4.49
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
|
@@ -828,10 +828,10 @@ export async function getAuditFile( req, res ) {
|
|
|
828
828
|
|
|
829
829
|
export async function getUpdatedFile( req, res ) {
|
|
830
830
|
try {
|
|
831
|
+
const url = JSON.parse( process.env.URL );
|
|
831
832
|
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
832
833
|
const inputData = req.body;
|
|
833
834
|
const msg = req?.TraxData?.sqs?.Body;
|
|
834
|
-
logger.info( { msg: msg } );
|
|
835
835
|
let result =[];
|
|
836
836
|
switch ( inputData.moduleType ) {
|
|
837
837
|
case 'camera-angle-change':
|
|
@@ -900,11 +900,12 @@ export async function getUpdatedFile( req, res ) {
|
|
|
900
900
|
logger.info( { folderPath: list, params: params, list: list } );
|
|
901
901
|
if ( folderPath?.length ) {
|
|
902
902
|
for ( let i = 0; i < folderPath.length; i++ ) {
|
|
903
|
-
const signedParams ={
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
};
|
|
907
|
-
const
|
|
903
|
+
// const signedParams ={
|
|
904
|
+
// Bucket: msg.inputBucketName,
|
|
905
|
+
// file_path: folderPath[i].Key,
|
|
906
|
+
// };
|
|
907
|
+
const BucketCDN = url.traxAuditInput;
|
|
908
|
+
const data = `${BucketCDN}${ folderPath[i].Key}`;
|
|
908
909
|
|
|
909
910
|
files.push(
|
|
910
911
|
data,
|
|
@@ -913,7 +914,7 @@ export async function getUpdatedFile( req, res ) {
|
|
|
913
914
|
} else {
|
|
914
915
|
logger.error( {
|
|
915
916
|
error: { folderPath: folderPath },
|
|
916
|
-
function: `
|
|
917
|
+
function: `getUpdatedFile - ${inputData.moduleType}`,
|
|
917
918
|
message: 'Bucket image data not availale',
|
|
918
919
|
} );
|
|
919
920
|
return res.sendError( 'Bucket is Empty', 204 );
|
|
@@ -994,7 +995,7 @@ export async function getUpdatedFile( req, res ) {
|
|
|
994
995
|
address: storeInfo?.address,
|
|
995
996
|
customerId: msg.tempId,
|
|
996
997
|
moduleType: inputData.moduleType,
|
|
997
|
-
value: inputData.moduleType == 'left-in-middle'? 'Employee Left in Middle ' : ( inputData.moduleType ).split( '-' ).join( ' ' ),
|
|
998
|
+
value: inputData.moduleType == 'left-in-middle'? 'Employee Left in Middle ' : inputData.moduleType == 'cleaning'? 'Store Cleaning Audit ': inputData.moduleType == 'scrum'? 'Scrum Identification':( inputData.moduleType ).split( '-' ).join( ' ' ),
|
|
998
999
|
fileDate: msg.fileDate,
|
|
999
1000
|
question: msg.question,
|
|
1000
1001
|
questionType: msg.questionType,
|
|
@@ -1451,6 +1452,124 @@ export async function userAuditHistory( req, res ) {
|
|
|
1451
1452
|
} );
|
|
1452
1453
|
}
|
|
1453
1454
|
|
|
1455
|
+
let traxAuditDataQuery={};
|
|
1456
|
+
let traxAuditDataFilter = [];
|
|
1457
|
+
switch ( inputData.moduleType ) {
|
|
1458
|
+
case 'unattended-customer':
|
|
1459
|
+
traxAuditDataQuery= {
|
|
1460
|
+
fileDate: '$fileDate', storeId: '$storeId', tempId: '$tempId', moduleType: '$moduleType',
|
|
1461
|
+
};
|
|
1462
|
+
traxAuditDataFilter=[ {
|
|
1463
|
+
$eq: [ '$fileDate', '$$fileDate' ],
|
|
1464
|
+
},
|
|
1465
|
+
{
|
|
1466
|
+
$eq: [ '$storeId', '$$storeId' ],
|
|
1467
|
+
},
|
|
1468
|
+
{
|
|
1469
|
+
$eq: [ '$tempId', '$$tempId' ],
|
|
1470
|
+
},
|
|
1471
|
+
{
|
|
1472
|
+
$eq: [ '$moduleType', '$$moduleType' ],
|
|
1473
|
+
},
|
|
1474
|
+
];
|
|
1475
|
+
break;
|
|
1476
|
+
case 'left-in-middle':
|
|
1477
|
+
traxAuditDataQuery= {
|
|
1478
|
+
fileDate: '$fileDate', storeId: '$storeId', tempId: '$tempId', moduleType: '$moduleType',
|
|
1479
|
+
};
|
|
1480
|
+
traxAuditDataFilter=[ {
|
|
1481
|
+
$eq: [ '$fileDate', '$$fileDate' ],
|
|
1482
|
+
},
|
|
1483
|
+
{
|
|
1484
|
+
$eq: [ '$storeId', '$$storeId' ],
|
|
1485
|
+
},
|
|
1486
|
+
{
|
|
1487
|
+
$eq: [ '$question', '$$question' ],
|
|
1488
|
+
},
|
|
1489
|
+
{
|
|
1490
|
+
$eq: [ '$moduleType', '$$moduleType' ],
|
|
1491
|
+
},
|
|
1492
|
+
];
|
|
1493
|
+
break;
|
|
1494
|
+
case 'uniform-detection':
|
|
1495
|
+
case 'mobile-detection':
|
|
1496
|
+
case 'scrum':
|
|
1497
|
+
case 'cleaning':
|
|
1498
|
+
traxAuditDataQuery= {
|
|
1499
|
+
fileDate: '$fileDate', storeId: '$storeId', moduleType: '$moduleType',
|
|
1500
|
+
};
|
|
1501
|
+
traxAuditDataFilter=[ {
|
|
1502
|
+
$eq: [ '$fileDate', '$$fileDate' ],
|
|
1503
|
+
},
|
|
1504
|
+
{
|
|
1505
|
+
$eq: [ '$storeId', '$$storeId' ],
|
|
1506
|
+
},
|
|
1507
|
+
{
|
|
1508
|
+
$eq: [ '$moduleType', '$$moduleType' ],
|
|
1509
|
+
},
|
|
1510
|
+
];
|
|
1511
|
+
break;
|
|
1512
|
+
case 'camera-angle-change':
|
|
1513
|
+
traxAuditDataQuery= {
|
|
1514
|
+
fileDate: '$fileDate', storeId: '$storeId', moduleType: '$moduleType', streamName: '$streamName',
|
|
1515
|
+
};
|
|
1516
|
+
traxAuditDataFilter=[ {
|
|
1517
|
+
$eq: [ '$fileDate', '$$fileDate' ],
|
|
1518
|
+
},
|
|
1519
|
+
{
|
|
1520
|
+
$eq: [ '$storeId', '$$storeId' ],
|
|
1521
|
+
},
|
|
1522
|
+
{
|
|
1523
|
+
$eq: [ '$streamName', '$$streamName' ],
|
|
1524
|
+
},
|
|
1525
|
+
{
|
|
1526
|
+
$eq: [ '$moduleType', '$$moduleType' ],
|
|
1527
|
+
},
|
|
1528
|
+
];
|
|
1529
|
+
break;
|
|
1530
|
+
case 'hygiene':
|
|
1531
|
+
traxAuditDataQuery= {
|
|
1532
|
+
fileDate: '$fileDate', storeId: '$storeId', moduleType: '$moduleType', zoneName: '$zoneName',
|
|
1533
|
+
};
|
|
1534
|
+
traxAuditDataFilter=[ {
|
|
1535
|
+
$eq: [ '$fileDate', '$$fileDate' ],
|
|
1536
|
+
},
|
|
1537
|
+
{
|
|
1538
|
+
$eq: [ '$storeId', '$$storeId' ],
|
|
1539
|
+
},
|
|
1540
|
+
{
|
|
1541
|
+
$eq: [ '$zoneName', '$$zoneName' ],
|
|
1542
|
+
},
|
|
1543
|
+
{
|
|
1544
|
+
$eq: [ '$moduleType', '$$moduleType' ],
|
|
1545
|
+
},
|
|
1546
|
+
];
|
|
1547
|
+
break;
|
|
1548
|
+
case 'eye-test-camera':
|
|
1549
|
+
traxAuditDataQuery= {
|
|
1550
|
+
fileDate: '$fileDate', storeId: '$storeId', moduleType: '$moduleType', question: '$question', streamName: '$streamName',
|
|
1551
|
+
};
|
|
1552
|
+
traxAuditDataFilter=[ {
|
|
1553
|
+
$eq: [ '$fileDate', '$$fileDate' ],
|
|
1554
|
+
},
|
|
1555
|
+
{
|
|
1556
|
+
$eq: [ '$storeId', '$$storeId' ],
|
|
1557
|
+
},
|
|
1558
|
+
{
|
|
1559
|
+
$eq: [ '$question', '$$question' ],
|
|
1560
|
+
},
|
|
1561
|
+
{
|
|
1562
|
+
$eq: [ '$streamName', '$$streamName' ],
|
|
1563
|
+
},
|
|
1564
|
+
{
|
|
1565
|
+
$eq: [ '$moduleType', '$$moduleType' ],
|
|
1566
|
+
},
|
|
1567
|
+
];
|
|
1568
|
+
break;
|
|
1569
|
+
default:
|
|
1570
|
+
return res.sendError( 'Please give valid modueType', 400 );
|
|
1571
|
+
}
|
|
1572
|
+
|
|
1454
1573
|
const query = [
|
|
1455
1574
|
{
|
|
1456
1575
|
$match: {
|
|
@@ -1511,24 +1630,12 @@ export async function userAuditHistory( req, res ) {
|
|
|
1511
1630
|
{
|
|
1512
1631
|
$lookup: {
|
|
1513
1632
|
from: 'traxAuditData',
|
|
1514
|
-
let:
|
|
1515
|
-
fileDate: '$fileDate', storeId: '$storeId', zoneName: '$zoneName',
|
|
1516
|
-
},
|
|
1633
|
+
let: traxAuditDataQuery,
|
|
1517
1634
|
pipeline: [
|
|
1518
1635
|
{
|
|
1519
1636
|
$match: {
|
|
1520
1637
|
$expr: {
|
|
1521
|
-
$and:
|
|
1522
|
-
{
|
|
1523
|
-
$eq: [ '$fileDate', '$$fileDate' ],
|
|
1524
|
-
},
|
|
1525
|
-
{
|
|
1526
|
-
$eq: [ '$storeId', '$$storeId' ],
|
|
1527
|
-
},
|
|
1528
|
-
{
|
|
1529
|
-
$eq: [ '$zoneName', '$$zoneName' ],
|
|
1530
|
-
},
|
|
1531
|
-
],
|
|
1638
|
+
$and: traxAuditDataFilter,
|
|
1532
1639
|
},
|
|
1533
1640
|
},
|
|
1534
1641
|
},
|
|
@@ -3991,7 +4098,7 @@ export async function getDetectionAuditFile( req, res ) {
|
|
|
3991
4098
|
if ( !consumer ) {
|
|
3992
4099
|
logger.error( {
|
|
3993
4100
|
error: consumer,
|
|
3994
|
-
function: `
|
|
4101
|
+
function: `getDetectionAuditFile - ${inputData.moduleType}`,
|
|
3995
4102
|
message: 'SQS Receive queue is empty',
|
|
3996
4103
|
} );
|
|
3997
4104
|
return res.sendError( `${inputData.queueName} is Empty`, 204 );
|
|
@@ -80,14 +80,9 @@ export async function isTraxAuditDocumentExist( req, res, next ) {
|
|
|
80
80
|
};
|
|
81
81
|
break;
|
|
82
82
|
case 'uniform-detection':
|
|
83
|
-
query ={
|
|
84
|
-
storeId: inputData.storeId,
|
|
85
|
-
fileDate: inputData.fileDate,
|
|
86
|
-
// tempId: inputData.tempId,
|
|
87
|
-
moduleType: inputData.moduleType,
|
|
88
|
-
};
|
|
89
|
-
break;
|
|
90
83
|
case 'mobile-detection':
|
|
84
|
+
case 'scrum':
|
|
85
|
+
case 'cleaning':
|
|
91
86
|
query ={
|
|
92
87
|
storeId: inputData.storeId,
|
|
93
88
|
fileDate: inputData.fileDate,
|
|
@@ -95,18 +90,10 @@ export async function isTraxAuditDocumentExist( req, res, next ) {
|
|
|
95
90
|
};
|
|
96
91
|
break;
|
|
97
92
|
case 'camera-angle-change':
|
|
98
|
-
query ={
|
|
99
|
-
storeId: inputData.storeId,
|
|
100
|
-
fileDate: inputData.fileDate,
|
|
101
|
-
streamName: inputData.streamName,
|
|
102
|
-
moduleType: inputData.moduleType,
|
|
103
|
-
};
|
|
104
|
-
break;
|
|
105
93
|
case 'eye-test-camera':
|
|
106
94
|
query ={
|
|
107
95
|
storeId: inputData.storeId,
|
|
108
96
|
fileDate: inputData.fileDate,
|
|
109
|
-
// question: inputData.question,
|
|
110
97
|
streamName: inputData.streamName,
|
|
111
98
|
moduleType: inputData.moduleType,
|
|
112
99
|
};
|