tango-app-api-audit 3.4.60 → 3.4.62
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
|
@@ -4845,6 +4845,9 @@ export async function auditViewLogs( req, res ) {
|
|
|
4845
4845
|
break;
|
|
4846
4846
|
case 'uniform-detection':
|
|
4847
4847
|
case 'mobile-detection':
|
|
4848
|
+
case 'cleaning':
|
|
4849
|
+
case 'open-time':
|
|
4850
|
+
case 'close-time':
|
|
4848
4851
|
logsQuery = {
|
|
4849
4852
|
'size': 100,
|
|
4850
4853
|
'query': {
|
|
@@ -4956,41 +4959,41 @@ export async function auditViewLogs( req, res ) {
|
|
|
4956
4959
|
],
|
|
4957
4960
|
};
|
|
4958
4961
|
break;
|
|
4959
|
-
|
|
4962
|
+
|
|
4960
4963
|
case 'cleaning':
|
|
4961
|
-
logsQuery = {
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4984
|
-
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
};
|
|
4993
|
-
break;
|
|
4964
|
+
// logsQuery = {
|
|
4965
|
+
// 'size': 100,
|
|
4966
|
+
// 'query': {
|
|
4967
|
+
// 'bool': {
|
|
4968
|
+
// 'must': [
|
|
4969
|
+
// {
|
|
4970
|
+
// 'term': {
|
|
4971
|
+
// 'logData.fileDate.keyword': inputData.fileDate,
|
|
4972
|
+
// },
|
|
4973
|
+
// },
|
|
4974
|
+
// {
|
|
4975
|
+
// 'term': {
|
|
4976
|
+
// 'logData.storeId.keyword': inputData.storeId,
|
|
4977
|
+
// },
|
|
4978
|
+
// },
|
|
4979
|
+
// {
|
|
4980
|
+
// 'term': {
|
|
4981
|
+
// 'logData.moduleType.keyword': inputData.moduleType,
|
|
4982
|
+
// },
|
|
4983
|
+
// },
|
|
4984
|
+
// {
|
|
4985
|
+
// 'terms': {
|
|
4986
|
+
// 'logSubType.keyword': [ 'auditDone', 'reTrigger' ],
|
|
4987
|
+
// },
|
|
4988
|
+
// },
|
|
4989
|
+
// ],
|
|
4990
|
+
// },
|
|
4991
|
+
// },
|
|
4992
|
+
// 'sort': [
|
|
4993
|
+
// { createdAt: { order: 'desc' } },
|
|
4994
|
+
// ],
|
|
4995
|
+
// };
|
|
4996
|
+
// break;
|
|
4994
4997
|
default:
|
|
4995
4998
|
return res.sendError( 'Please give valid modueType', 400 );
|
|
4996
4999
|
}
|
|
@@ -1265,7 +1265,7 @@ export async function saveBinary( req, res ) {
|
|
|
1265
1265
|
_id: inputData.auditId,
|
|
1266
1266
|
storeId: inputData.storeId,
|
|
1267
1267
|
fileDate: inputData.fileDate,
|
|
1268
|
-
|
|
1268
|
+
streamName: req.userAudit?.streamName,
|
|
1269
1269
|
moduleType: inputData.moduleType,
|
|
1270
1270
|
};
|
|
1271
1271
|
|
|
@@ -1647,7 +1647,7 @@ export async function saveBinary( req, res ) {
|
|
|
1647
1647
|
_id: inputData.auditId,
|
|
1648
1648
|
storeId: inputData.storeId,
|
|
1649
1649
|
fileDate: inputData.fileDate,
|
|
1650
|
-
|
|
1650
|
+
streamName: req.userAudit?.streamName,
|
|
1651
1651
|
moduleType: inputData.moduleType,
|
|
1652
1652
|
};
|
|
1653
1653
|
|
|
@@ -1680,7 +1680,7 @@ export async function saveBinary( req, res ) {
|
|
|
1680
1680
|
},
|
|
1681
1681
|
{
|
|
1682
1682
|
'term': {
|
|
1683
|
-
'
|
|
1683
|
+
'streamName.keyword': inputData.streamName,
|
|
1684
1684
|
},
|
|
1685
1685
|
},
|
|
1686
1686
|
];
|
|
@@ -2626,6 +2626,8 @@ export async function storeMetrics( req, res ) {
|
|
|
2626
2626
|
case 'mobile-detection':
|
|
2627
2627
|
case 'scrum':
|
|
2628
2628
|
case 'cleaning':
|
|
2629
|
+
case 'open-time':
|
|
2630
|
+
case 'close-time':
|
|
2629
2631
|
traxAuditDataQuery= {
|
|
2630
2632
|
fileDate: '$fileDate', storeId: '$storeId', moduleType: '$moduleType',
|
|
2631
2633
|
};
|
|
@@ -3638,6 +3640,8 @@ export async function pendingSummaryTable( req, res ) {
|
|
|
3638
3640
|
case 'mobile-detection':
|
|
3639
3641
|
case 'scrum':
|
|
3640
3642
|
case 'cleaning':
|
|
3643
|
+
case 'open-time':
|
|
3644
|
+
case 'close-time':
|
|
3641
3645
|
traxAuditDataQuery= {
|
|
3642
3646
|
fileDate: '$fileDate', storeId: '$storeId', moduleType: '$moduleType',
|
|
3643
3647
|
};
|
|
@@ -4935,12 +4939,31 @@ export async function getDetectionAuditFile( req, res ) {
|
|
|
4935
4939
|
startTime: new Date(),
|
|
4936
4940
|
moduleType: inputData.moduleType,
|
|
4937
4941
|
};
|
|
4938
|
-
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4942
|
+
let query ={};
|
|
4943
|
+
switch ( inputData.moduleType ) {
|
|
4944
|
+
case 'open-time':
|
|
4945
|
+
|
|
4946
|
+
case 'close-time':
|
|
4947
|
+
|
|
4948
|
+
case 'mobile-detection':
|
|
4949
|
+
|
|
4950
|
+
case 'uniform-detection':
|
|
4951
|
+
query = {
|
|
4952
|
+
storeId: msg.storeId,
|
|
4953
|
+
fileDate: msg.fileDate,
|
|
4954
|
+
moduleType: inputData.moduleType,
|
|
4955
|
+
};
|
|
4956
|
+
break;
|
|
4957
|
+
case 'hygiene':
|
|
4958
|
+
query = {
|
|
4959
|
+
storeId: msg.storeId,
|
|
4960
|
+
zoneName: msg.zoneName,
|
|
4961
|
+
fileDate: msg.fileDate,
|
|
4962
|
+
moduleType: inputData.moduleType,
|
|
4963
|
+
};
|
|
4964
|
+
break;
|
|
4965
|
+
}
|
|
4966
|
+
|
|
4944
4967
|
const storeRecord = {
|
|
4945
4968
|
userId: req.user._id,
|
|
4946
4969
|
storeId: msg.storeId,
|
|
@@ -5143,6 +5166,7 @@ export async function getDraftedData( req, res ) {
|
|
|
5143
5166
|
|
|
5144
5167
|
export async function save( req, res ) {
|
|
5145
5168
|
try {
|
|
5169
|
+
const url = JSON.parse( process.env.URL );
|
|
5146
5170
|
const openSearch = JSON.parse( process.env.OPENSEARCH );
|
|
5147
5171
|
const bucket = JSON.parse( process.env.BUCKET );
|
|
5148
5172
|
const sqs = JSON.parse( process.env.SQS );
|
|
@@ -5288,6 +5312,21 @@ export async function save( req, res ) {
|
|
|
5288
5312
|
await copyImage( copyParams );
|
|
5289
5313
|
}
|
|
5290
5314
|
|
|
5315
|
+
if ( inputData.moduleType == 'hygiene' && inputData.employeeCount> 0 ) {
|
|
5316
|
+
const hygieneTaskData = {
|
|
5317
|
+
storeName: getStore?.storeName,
|
|
5318
|
+
taskName: 'Store Hygiene Check',
|
|
5319
|
+
question: 'A store hygiene issue has been detected. Upload a new image showing the current store condition.',
|
|
5320
|
+
answerType: 'descriptiveImage',
|
|
5321
|
+
referenceImage: [ `${output.folderPath}${tempId[0]}` ],
|
|
5322
|
+
zoneName: inputData?.zoneName,
|
|
5323
|
+
};
|
|
5324
|
+
await axios.post( `${url.apiDomain}/v3/task/StoreHygienetask`, hygieneTaskData, { headers: {
|
|
5325
|
+
'Content-Type': 'application/json',
|
|
5326
|
+
'Authorization': 'Bearer d47433f8-9a33-47c7-ba43-1a0fbac28f55' },
|
|
5327
|
+
} );
|
|
5328
|
+
}
|
|
5329
|
+
|
|
5291
5330
|
const logData = {
|
|
5292
5331
|
userId: req.user._id,
|
|
5293
5332
|
userName: req.user.userName,
|