tango-app-api-audit 3.4.21 → 3.4.23
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
|
@@ -4805,6 +4805,42 @@ export async function auditViewLogs( req, res ) {
|
|
|
4805
4805
|
},
|
|
4806
4806
|
};
|
|
4807
4807
|
break;
|
|
4808
|
+
case 'hygiene':
|
|
4809
|
+
logsQuery = {
|
|
4810
|
+
'size': 100,
|
|
4811
|
+
'query': {
|
|
4812
|
+
'bool': {
|
|
4813
|
+
'must': [
|
|
4814
|
+
{
|
|
4815
|
+
'term': {
|
|
4816
|
+
'logData.fileDate.keyword': inputData.fileDate,
|
|
4817
|
+
},
|
|
4818
|
+
},
|
|
4819
|
+
{
|
|
4820
|
+
'term': {
|
|
4821
|
+
'logData.storeId.keyword': inputData.storeId,
|
|
4822
|
+
},
|
|
4823
|
+
},
|
|
4824
|
+
{
|
|
4825
|
+
'term': {
|
|
4826
|
+
'logData.moduleType.keyword': inputData.moduleType,
|
|
4827
|
+
},
|
|
4828
|
+
},
|
|
4829
|
+
{
|
|
4830
|
+
'term': {
|
|
4831
|
+
'logData.zoneName.keyword': inputData.zoneName,
|
|
4832
|
+
},
|
|
4833
|
+
},
|
|
4834
|
+
{
|
|
4835
|
+
'terms': {
|
|
4836
|
+
'logSubType.keyword': [ 'auditDone', 'reTrigger' ],
|
|
4837
|
+
},
|
|
4838
|
+
},
|
|
4839
|
+
],
|
|
4840
|
+
},
|
|
4841
|
+
},
|
|
4842
|
+
};
|
|
4843
|
+
break;
|
|
4808
4844
|
case 'camera-angle-change':
|
|
4809
4845
|
logsQuery = {
|
|
4810
4846
|
'size': 100,
|
|
@@ -3067,7 +3067,30 @@ export async function summarySplit( req, res ) {
|
|
|
3067
3067
|
{ moduleType: { $eq: inputData.moduleType } },
|
|
3068
3068
|
{ clientId: { $in: inputData.clientId } },
|
|
3069
3069
|
];
|
|
3070
|
+
const totalQuery = [
|
|
3071
|
+
{
|
|
3072
|
+
$match: {
|
|
3073
|
+
$and: filters,
|
|
3074
|
+
},
|
|
3070
3075
|
|
|
3076
|
+
},
|
|
3077
|
+
{
|
|
3078
|
+
$group: {
|
|
3079
|
+
_id: null,
|
|
3080
|
+
total: { $sum: 1 },
|
|
3081
|
+
},
|
|
3082
|
+
},
|
|
3083
|
+
{
|
|
3084
|
+
$project: {
|
|
3085
|
+
_id: 0,
|
|
3086
|
+
total: 1,
|
|
3087
|
+
},
|
|
3088
|
+
},
|
|
3089
|
+
];
|
|
3090
|
+
const totalCount = await aggregateTraxAuditData( totalQuery );
|
|
3091
|
+
if ( totalCount.length == 0 ) {
|
|
3092
|
+
return res.sendError( 'No Data Found', 204 );
|
|
3093
|
+
}
|
|
3071
3094
|
|
|
3072
3095
|
const binaryAuditQuery =[
|
|
3073
3096
|
{
|
|
@@ -3194,28 +3217,8 @@ export async function summarySplit( req, res ) {
|
|
|
3194
3217
|
},
|
|
3195
3218
|
},
|
|
3196
3219
|
];
|
|
3197
|
-
const totalQuery = [
|
|
3198
|
-
{
|
|
3199
|
-
$match: {
|
|
3200
|
-
$and: filters,
|
|
3201
|
-
},
|
|
3202
3220
|
|
|
3203
|
-
},
|
|
3204
|
-
{
|
|
3205
|
-
$group: {
|
|
3206
|
-
_id: null,
|
|
3207
|
-
total: { $sum: 1 },
|
|
3208
|
-
},
|
|
3209
|
-
},
|
|
3210
|
-
{
|
|
3211
|
-
$project: {
|
|
3212
|
-
_id: 0,
|
|
3213
|
-
total: 1,
|
|
3214
|
-
},
|
|
3215
|
-
},
|
|
3216
|
-
];
|
|
3217
3221
|
const result = [ 'mobile-detection', 'uniform-detection', 'hygiene' ].includes( inputData.moduleType )? await aggregateStoreEmpDetection( query ) : await aggregateBinaryAudit( binaryAuditQuery );
|
|
3218
|
-
const totalCount = await aggregateTraxAuditData( totalQuery );
|
|
3219
3222
|
result[0].totalCount = totalCount[0]?.total;
|
|
3220
3223
|
return res.sendSuccess( { result: result.length> 0? result[0]: temp } );
|
|
3221
3224
|
} catch ( error ) {
|
|
@@ -3623,23 +3626,23 @@ export async function getDetectionAuditFile( req, res ) {
|
|
|
3623
3626
|
const list = await listFileByPath( fetchData );
|
|
3624
3627
|
const folderPath = list.data;
|
|
3625
3628
|
const nextQuery = list.pageToken;
|
|
3626
|
-
const bucketCDN =
|
|
3629
|
+
const bucketCDN = url.traxAuditInput;
|
|
3627
3630
|
if ( folderPath?.length > 0 ) {
|
|
3628
3631
|
for ( let i = 0; i < folderPath.length; i++ ) {
|
|
3629
3632
|
const img = folderPath[i].Key.split( '/' );
|
|
3630
|
-
const image = img[3].split( '.' );
|
|
3633
|
+
const image = inputData.moduleType=='hygiene'?img[4].split( '.' ): img[3].split( '.' );
|
|
3631
3634
|
const indexes = image[0].split( '_' );
|
|
3632
3635
|
const Key = folderPath[i].Key;
|
|
3633
3636
|
const data = `${bucketCDN}${Key}`;// await signedUrl( fetchData );
|
|
3634
3637
|
const mapimg = {
|
|
3635
3638
|
img_path: data,
|
|
3636
3639
|
img_name: inputData.moduleType=='mobile-detection'?`${indexes[0]}-${indexes[3]}` : inputData.moduleType=='hygiene'?`${indexes[2]}-${indexes[3]}`:image[0],
|
|
3637
|
-
img_id: img[3],
|
|
3640
|
+
img_id: inputData.moduleType=='hygiene'? img[4] : img[3],
|
|
3638
3641
|
};
|
|
3639
3642
|
files.push( {
|
|
3640
3643
|
img_path: data,
|
|
3641
3644
|
img_name: inputData.moduleType=='mobile-detection'?`${indexes[0]}-${indexes[3]}`: inputData.moduleType=='hygiene'?`${indexes[2]}-${indexes[3]}`:image[0],
|
|
3642
|
-
img_id: img[3],
|
|
3645
|
+
img_id: inputData.moduleType=='hygiene'? img[4] : img[3],
|
|
3643
3646
|
selected: false,
|
|
3644
3647
|
dropped: false,
|
|
3645
3648
|
singleDetection: false,
|