tango-app-api-audit 3.4.69-beta.0 → 3.5.0
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-audit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
4
4
|
"description": "audit & audit metrics apis",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"nodemon": "^3.1.3",
|
|
28
28
|
"swagger-ui-express": "^5.0.1",
|
|
29
29
|
"tango-api-schema": "^2.2.113",
|
|
30
|
-
"tango-app-api-middleware": "^3.1.
|
|
30
|
+
"tango-app-api-middleware": "^3.1.76",
|
|
31
31
|
"winston": "^3.13.0",
|
|
32
32
|
"winston-daily-rotate-file": "^5.0.0"
|
|
33
33
|
},
|
|
@@ -65,7 +65,7 @@ import { aggregateBinaryAudit } from '../service/binaryAudit.service.js';
|
|
|
65
65
|
import { aggregateTraxAuditData, findOneTraxAuditData } from '../service/traxAuditData.service.js';
|
|
66
66
|
import { bulkWriteAuditUserWallet, createAuditUserWallet, findOneAuditUserWallet } from '../service/auditUserWallet.service.js';
|
|
67
67
|
import { updateOneAuditUsers } from '../service/auditUsers.service.js';
|
|
68
|
-
import { bulkUpdate, clearScroll, scrollResponse, searchOpenSearchData } from 'tango-app-api-middleware/src/utils/openSearch.js';
|
|
68
|
+
import { bulkUpdate, clearScroll, upsertOpenSearchData, scrollResponse, searchOpenSearchData } from 'tango-app-api-middleware/src/utils/openSearch.js';
|
|
69
69
|
// import { aggregateAuditUsers } from '../service/auditUsers.service.js';
|
|
70
70
|
|
|
71
71
|
/* < -- *** Configuration *** --> */
|
|
@@ -539,7 +539,7 @@ export async function getAuditFile( req, res ) {
|
|
|
539
539
|
|
|
540
540
|
const getQuery = {
|
|
541
541
|
size: inputData?.limit || 2,
|
|
542
|
-
_source: [ 'module', 'date', 'store_id', 'outputCluster', 'personPath', 'isEmployee' ], // Only fetch necessary fields
|
|
542
|
+
_source: [ 'module', 'date', 'store_id', 'outputCluster', 'personPath', 'isEmployee', 'isJunk' ], // Only fetch necessary fields
|
|
543
543
|
|
|
544
544
|
query: {
|
|
545
545
|
bool: {
|
|
@@ -547,6 +547,9 @@ export async function getAuditFile( req, res ) {
|
|
|
547
547
|
{
|
|
548
548
|
term: { 'store_id.keyword': msg.store_id },
|
|
549
549
|
},
|
|
550
|
+
// {
|
|
551
|
+
// term: { isJunk: false },
|
|
552
|
+
// },
|
|
550
553
|
{
|
|
551
554
|
term: { isEmployee: false },
|
|
552
555
|
},
|
|
@@ -1530,7 +1533,7 @@ export async function save( req, res ) {
|
|
|
1530
1533
|
const temp = getData?.body?.hits?.hits?.map( ( item ) => item._id );
|
|
1531
1534
|
const body = temp.flatMap( ( id ) => [
|
|
1532
1535
|
{ update: { _index: 'tracker_process', _id: id } },
|
|
1533
|
-
{ doc: { outputCluster: imgName } },
|
|
1536
|
+
{ doc: { outputCluster: imgName, isEmployee: false, isJunk: false } },
|
|
1534
1537
|
] );
|
|
1535
1538
|
const re= await bulkUpdate( body );
|
|
1536
1539
|
logger.info( { re: re } );
|
|
@@ -1669,22 +1672,34 @@ export async function save( req, res ) {
|
|
|
1669
1672
|
timeSpent: inputData.timeSpent,
|
|
1670
1673
|
},
|
|
1671
1674
|
);
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1675
|
+
if ( inputData.moduleType !== 'track' ) {
|
|
1676
|
+
const sqsProduceQueue = {
|
|
1677
|
+
QueueUrl: ( auditConfig?.isCheckMinAfterCount ==1 && inputData.customerCount > auditConfig?.minAfterCount ) ? `${sqs.url}${sqs.feature_new}`: `${sqs.url}${sqs.feature}`,
|
|
1678
|
+
MessageBody: JSON.stringify( {
|
|
1679
|
+
store_id: inputData.storeId,
|
|
1680
|
+
store_date: inputData.fileDate,
|
|
1681
|
+
bucket_name: `${bucket.auditUploadBucket}`,
|
|
1682
|
+
zone_id: inputData.zoneName,
|
|
1683
|
+
process_type: 'audit',
|
|
1684
|
+
} ),
|
|
1685
|
+
};
|
|
1686
|
+
logger.info( { sqsProduceQueue: sqsProduceQueue } );
|
|
1687
|
+
const sqsQueue = await sendMessageToQueue(
|
|
1688
|
+
sqsProduceQueue.QueueUrl,
|
|
1689
|
+
sqsProduceQueue.MessageBody,
|
|
1690
|
+
);
|
|
1691
|
+
logger.info( { sqsQueue: sqsQueue } );
|
|
1692
|
+
} else {
|
|
1693
|
+
const query =
|
|
1694
|
+
{ 'module': 'REID-TRACKER-V1',
|
|
1695
|
+
'store_date_time': `${inputData.storeId}_${inputData.fileDate}_23:00`,
|
|
1696
|
+
'status': 'POSTPROCESS_AUDIT_SUCCESS',
|
|
1697
|
+
'status_time': Date.now(),
|
|
1698
|
+
'timestamp': new Date() };
|
|
1699
|
+
|
|
1700
|
+
|
|
1701
|
+
await upsertOpenSearchData( 'tracker_process', `${inputData.storeId}_${inputData.fileDate}_23:00`, { doc: query } );
|
|
1702
|
+
}
|
|
1688
1703
|
}
|
|
1689
1704
|
|
|
1690
1705
|
return res.sendSuccess( { result: 'Updated Successfully' } );
|