tango-app-api-audit 3.5.2 → 3.5.3
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
|
@@ -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, upsertOpenSearchData, scrollResponse, searchOpenSearchData } from 'tango-app-api-middleware/src/utils/openSearch.js';
|
|
68
|
+
import { bulkUpdate, clearScroll, upsertOpenSearchData, scrollResponse, searchOpenSearchData, updateOpenSearchData } 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', 'isJunk' ], // Only fetch necessary fields
|
|
542
|
+
_source: [ 'module', 'status', 'date', 'store_id', 'outputCluster', 'personPath', 'isEmployee', 'isJunk', 'EmployeeStatusFinal' ], // Only fetch necessary fields
|
|
543
543
|
|
|
544
544
|
query: {
|
|
545
545
|
bool: {
|
|
@@ -547,16 +547,18 @@ export async function getAuditFile( req, res ) {
|
|
|
547
547
|
{
|
|
548
548
|
term: { 'store_id.keyword': msg.store_id },
|
|
549
549
|
},
|
|
550
|
-
|
|
551
|
-
{
|
|
552
|
-
term: { isEmployee: false },
|
|
553
|
-
},
|
|
554
550
|
{
|
|
555
551
|
term: { 'date.keyword': msg.curr_date },
|
|
556
552
|
},
|
|
557
553
|
{
|
|
558
554
|
term: { 'module.keyword': 'CUSTOMER' },
|
|
559
555
|
},
|
|
556
|
+
{
|
|
557
|
+
term: { 'status.keyword': 'PP_CLUSTER_FORMED' },
|
|
558
|
+
},
|
|
559
|
+
{
|
|
560
|
+
terms: { EmployeeStatusFinal: [ 1, 2 ] },
|
|
561
|
+
},
|
|
560
562
|
],
|
|
561
563
|
'should': [
|
|
562
564
|
{ 'term': { 'isJunk': false } },
|
|
@@ -567,7 +569,6 @@ export async function getAuditFile( req, res ) {
|
|
|
567
569
|
},
|
|
568
570
|
|
|
569
571
|
};
|
|
570
|
-
|
|
571
572
|
const list = msg.zone_id === 'track' ? inputData.nextId? await scrollResponse( inputData.nextId ):await searchOpenSearchData( msg.index_name, getQuery ): await listFileByPath( fetchData );
|
|
572
573
|
const folderPath = msg.zone_id === 'track' ? list?.body?.hits?.hits : list.data;
|
|
573
574
|
const nextQuery =msg.zone_id !== 'track' ? list.pageToken: '';
|
|
@@ -659,6 +660,9 @@ export async function getAuditFile( req, res ) {
|
|
|
659
660
|
insertData = userDetails[0];
|
|
660
661
|
}
|
|
661
662
|
} else if ( inputData.nextId !== '' && inputData.nextId !== null && inputData.nextId !== undefined && inputData.moduleType === 'track' ) {
|
|
663
|
+
if ( !list ) {
|
|
664
|
+
return res.sendError( 'token expired', 404 );
|
|
665
|
+
}
|
|
662
666
|
list.body._scroll_id = '';
|
|
663
667
|
insertData = userDetails[0];
|
|
664
668
|
} else {
|
|
@@ -723,7 +727,7 @@ export async function getAuditFile( req, res ) {
|
|
|
723
727
|
message: req.query,
|
|
724
728
|
function: 'getAuditFile',
|
|
725
729
|
} );
|
|
726
|
-
return res.sendError( error, 500 );
|
|
730
|
+
return res.sendError( error.message, 500 );
|
|
727
731
|
}
|
|
728
732
|
}
|
|
729
733
|
function addUniqueFile( files, newFile ) {
|
|
@@ -3240,7 +3244,16 @@ export async function reTrigger( req, res ) {
|
|
|
3240
3244
|
};
|
|
3241
3245
|
await insertOpenSearchData( openSearch.auditLog, logData );
|
|
3242
3246
|
}
|
|
3247
|
+
const updateQuery ={
|
|
3248
|
+
module: 'REID-TRACKER-V1',
|
|
3249
|
+
store_date_time: `${inputData.storeId}_${inputData.fileDate}_23:00`,
|
|
3250
|
+
status: 'POSTPROCESS_AUDIT_INITIATED',
|
|
3251
|
+
statusvb_time: Math.floor( Date.now() / 1000 ),
|
|
3252
|
+
timestamp: new Date(),
|
|
3253
|
+
};
|
|
3254
|
+
|
|
3243
3255
|
|
|
3256
|
+
await updateOpenSearchData( 'tracker_process', `${inputData.storeId}_${inputData.fileDate}_23:00`, { doc: updateQuery } );
|
|
3244
3257
|
return res.sendSuccess( { result: 'The File has been Re-Triggered Succesfully' } );
|
|
3245
3258
|
} catch ( error ) {
|
|
3246
3259
|
const err = error.message;
|