tango-app-api-audit 3.4.40 → 3.4.42
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.4.
|
|
3
|
+
"version": "3.4.42",
|
|
4
4
|
"description": "audit & audit metrics apis",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"mongodb": "^6.7.0",
|
|
25
25
|
"nodemon": "^3.1.3",
|
|
26
26
|
"swagger-ui-express": "^5.0.1",
|
|
27
|
-
"tango-api-schema": "^2.2.
|
|
27
|
+
"tango-api-schema": "^2.2.45",
|
|
28
28
|
"tango-app-api-middleware": "^3.1.48",
|
|
29
29
|
"winston": "^3.13.0",
|
|
30
30
|
"winston-daily-rotate-file": "^5.0.0"
|
|
@@ -56,7 +56,11 @@ export async function workSpace( req, res ) {
|
|
|
56
56
|
{ $eq: [ inputData.moduleType, 'mobile-detection' ] }, '$auditConfigs.traxQueueName.mobileDetection',
|
|
57
57
|
{
|
|
58
58
|
$cond: [
|
|
59
|
-
{ $eq: [ inputData.moduleType, 'hygiene' ] }, '$auditConfigs.traxQueueName.hygiene',
|
|
59
|
+
{ $eq: [ inputData.moduleType, 'hygiene' ] }, '$auditConfigs.traxQueueName.hygiene', {
|
|
60
|
+
$cond: [
|
|
61
|
+
{ $eq: [ inputData.moduleType, 'camera-angle-change' ] }, '$auditConfigs.traxQueueName.cameraAngleChange', '$auditConfigs.traxQueueName.eyeTestCamera' ],
|
|
62
|
+
},
|
|
63
|
+
|
|
60
64
|
],
|
|
61
65
|
},
|
|
62
66
|
],
|
|
@@ -542,8 +546,17 @@ export async function getAuditFile( req, res ) {
|
|
|
542
546
|
moduleType: userDetails[0].moduleType,
|
|
543
547
|
};
|
|
544
548
|
break;
|
|
549
|
+
case 'eye-test-camera':
|
|
550
|
+
query ={
|
|
551
|
+
storeId: userDetails[0].storeId,
|
|
552
|
+
fileDate: userDetails[0].fileDate,
|
|
553
|
+
// question: userDetails[0].question,
|
|
554
|
+
streamName: userDetails[0].streamName,
|
|
555
|
+
moduleType: userDetails[0].moduleType,
|
|
556
|
+
};
|
|
557
|
+
break;
|
|
545
558
|
default:
|
|
546
|
-
return res.sendError( 'Please give valid
|
|
559
|
+
return res.sendError( 'Please give valid moduleType', 400 );
|
|
547
560
|
}
|
|
548
561
|
logger.info( { query: query } );
|
|
549
562
|
const traxInfo = await findOneTraxAuditData( query );
|
|
@@ -660,6 +673,32 @@ export async function getAuditFile( req, res ) {
|
|
|
660
673
|
} );
|
|
661
674
|
}
|
|
662
675
|
break;
|
|
676
|
+
case 'eye-test-camera':
|
|
677
|
+
const eyeTestfiles = [];
|
|
678
|
+
|
|
679
|
+
const eyeTestparams ={
|
|
680
|
+
Bucket: msg.inputBucketName,
|
|
681
|
+
Key: msg?.filePath,
|
|
682
|
+
};
|
|
683
|
+
|
|
684
|
+
const isCameraExists = await checkFileExist( eyeTestparams );
|
|
685
|
+
|
|
686
|
+
if ( isCameraExists ) {
|
|
687
|
+
const url = JSON.parse( process.env.URL );
|
|
688
|
+
logger.info( { url: url, cameraBaseImage: url.cameraBaseImage } );
|
|
689
|
+
const data = `${url.cameraBaseImage}${msg?.filePath}`;
|
|
690
|
+
|
|
691
|
+
eyeTestfiles.push(
|
|
692
|
+
data,
|
|
693
|
+
);
|
|
694
|
+
} else {
|
|
695
|
+
return res.sendSuccess( 'No Data found', 204 );
|
|
696
|
+
}
|
|
697
|
+
result.push( {
|
|
698
|
+
type: 'image',
|
|
699
|
+
file: eyeTestfiles,
|
|
700
|
+
} );
|
|
701
|
+
break;
|
|
663
702
|
default:
|
|
664
703
|
return res.sendError( 'Please given valid moduleType', 400 );
|
|
665
704
|
}
|
|
@@ -703,7 +742,7 @@ export async function getAuditFile( req, res ) {
|
|
|
703
742
|
questionType: msg.questionType,
|
|
704
743
|
streamName: msg.streamName,
|
|
705
744
|
};
|
|
706
|
-
record.streamName = inputData.moduleType == 'camera-angle-change'? msg.streamName : '';
|
|
745
|
+
record.streamName = inputData.moduleType == 'camera-angle-change' || inputData.moduleType == 'eye-test-camera'? msg.streamName : '';
|
|
707
746
|
record.videoDetails = inputData.moduleType == 'left-in-middle'? {
|
|
708
747
|
'startHour': msg.startHour,
|
|
709
748
|
'inspectHour': msg.inspectHour,
|
|
@@ -862,6 +901,31 @@ export async function getUpdatedFile( req, res ) {
|
|
|
862
901
|
} );
|
|
863
902
|
}
|
|
864
903
|
break;
|
|
904
|
+
case 'eye-test-camera':
|
|
905
|
+
const eyeTestfiles = [];
|
|
906
|
+
|
|
907
|
+
const eyeTestparams ={
|
|
908
|
+
Bucket: msg.inputBucketName,
|
|
909
|
+
Key: msg?.filePath,
|
|
910
|
+
};
|
|
911
|
+
|
|
912
|
+
const isCameraExists = await checkFileExist( eyeTestparams );
|
|
913
|
+
|
|
914
|
+
if ( isCameraExists ) {
|
|
915
|
+
const url = JSON.parse( process.env.URL );
|
|
916
|
+
const data = `${url.cameraBaseImage}${msg?.filePath}`;
|
|
917
|
+
|
|
918
|
+
eyeTestfiles.push(
|
|
919
|
+
data,
|
|
920
|
+
);
|
|
921
|
+
} else {
|
|
922
|
+
return res.sendSuccess( 'No Data found', 204 );
|
|
923
|
+
}
|
|
924
|
+
result.push( {
|
|
925
|
+
type: 'image',
|
|
926
|
+
file: eyeTestfiles,
|
|
927
|
+
} );
|
|
928
|
+
break;
|
|
865
929
|
default:
|
|
866
930
|
return res.sendError( 'Please given valid moduleType', 400 );
|
|
867
931
|
}
|
|
@@ -1164,9 +1228,29 @@ export async function saveBinary( req, res ) {
|
|
|
1164
1228
|
return res.sendSuccess( `Successfully updated in ${value}` );
|
|
1165
1229
|
|
|
1166
1230
|
break;
|
|
1231
|
+
case 'eye-test-camera':
|
|
1232
|
+
let eyeTestQuery ={
|
|
1233
|
+
_id: inputData.auditId,
|
|
1234
|
+
storeId: inputData.storeId,
|
|
1235
|
+
fileDate: inputData.fileDate,
|
|
1236
|
+
streamName: inputData.streamName,
|
|
1237
|
+
moduleType: inputData.moduleType,
|
|
1238
|
+
};
|
|
1239
|
+
let eyeTestUpdate={
|
|
1240
|
+
auditStatus: 'completed',
|
|
1241
|
+
answer: inputData.answer,
|
|
1242
|
+
userComments: inputData.userComments || '',
|
|
1243
|
+
endTime: new Date(),
|
|
1244
|
+
timeSpent: timeDifferenceInMinutes,
|
|
1245
|
+
};
|
|
1246
|
+
let updatDataEyeTest= await updateOneBinaryAuditModel( eyeTestQuery, eyeTestUpdate );
|
|
1247
|
+
if ( updatDataEyeTest.modifiedCount==0 ) {
|
|
1248
|
+
return res.sendError( 'Update failed, it may be invalid request', 400 );
|
|
1249
|
+
}
|
|
1250
|
+
return res.sendSuccess( `Successfully updated in ${value}` );
|
|
1167
1251
|
|
|
1168
1252
|
default:
|
|
1169
|
-
res.sendError( '
|
|
1253
|
+
res.sendError( 'No Data', 204 );
|
|
1170
1254
|
break;
|
|
1171
1255
|
}
|
|
1172
1256
|
} catch ( error ) {
|
|
@@ -2,7 +2,7 @@ import storeEmpDetectionModel from 'tango-api-schema/schema/storeEmpDetection.mo
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
export function aggregateStoreEmpDetection( query ) {
|
|
5
|
-
return storeEmpDetectionModel.aggregate( query
|
|
5
|
+
return storeEmpDetectionModel.aggregate( query );
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
export function findOneStoreEmpDetection( query ) {
|
|
@@ -102,6 +102,15 @@ export async function isTraxAuditDocumentExist( req, res, next ) {
|
|
|
102
102
|
moduleType: inputData.moduleType,
|
|
103
103
|
};
|
|
104
104
|
break;
|
|
105
|
+
case 'eye-test-camera':
|
|
106
|
+
query ={
|
|
107
|
+
storeId: inputData.storeId,
|
|
108
|
+
fileDate: inputData.fileDate,
|
|
109
|
+
// question: inputData.question,
|
|
110
|
+
streamName: inputData.streamName,
|
|
111
|
+
moduleType: inputData.moduleType,
|
|
112
|
+
};
|
|
113
|
+
break;
|
|
105
114
|
default:
|
|
106
115
|
return res.sendError( 'Please give valid modueType', 400 );
|
|
107
116
|
}
|