tango-app-api-audit 3.4.49 → 3.4.50
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,5 +1,5 @@
|
|
|
1
1
|
import { checkFileExist, chunkArray, download, getDate, getDateWithCustomizeTime, getObject, getOpenSearchData, getUTC, insertOpenSearchData, listFileByPath, logger, signedUrl, sqsReceive, updateOpenSearchData } from 'tango-app-api-middleware';
|
|
2
|
-
import { aggregateBinaryAudit,
|
|
2
|
+
import { aggregateBinaryAudit, findOneBinaryAudit, updateOneBinaryAuditModel, updateOneUpsertBinaryAudit } from '../service/binaryAudit.service.js';
|
|
3
3
|
import { countDocumentsStore, findOneStore } from '../service/store.service.js';
|
|
4
4
|
import { findOneUser } from '../service/user.service.js';
|
|
5
5
|
import { aggregateUserEmpDetection, countDocumentsUserEmpDetection, createUserEmpDetection, updateOneUserEmpDetection } from '../service/userEmpDetection.service.js';
|
|
@@ -543,14 +543,6 @@ export async function getAuditFile( req, res ) {
|
|
|
543
543
|
moduleType: userDetails[0].moduleType,
|
|
544
544
|
};
|
|
545
545
|
break;
|
|
546
|
-
case 'uniform-detection':
|
|
547
|
-
query ={
|
|
548
|
-
storeId: userDetails[0].storeId,
|
|
549
|
-
fileDate: userDetails[0].fileDate,
|
|
550
|
-
// tempId: userDetails[0].tempId,
|
|
551
|
-
moduleType: userDetails[0].moduleType,
|
|
552
|
-
};
|
|
553
|
-
break;
|
|
554
546
|
case 'camera-angle-change':
|
|
555
547
|
query ={
|
|
556
548
|
storeId: userDetails[0].storeId,
|
|
@@ -569,12 +561,6 @@ export async function getAuditFile( req, res ) {
|
|
|
569
561
|
};
|
|
570
562
|
break;
|
|
571
563
|
case 'cleaning':
|
|
572
|
-
query ={
|
|
573
|
-
storeId: userDetails[0].storeId,
|
|
574
|
-
fileDate: userDetails[0].fileDate,
|
|
575
|
-
moduleType: userDetails[0].moduleType,
|
|
576
|
-
};
|
|
577
|
-
break;
|
|
578
564
|
case 'scrum':
|
|
579
565
|
query ={
|
|
580
566
|
storeId: userDetails[0].storeId,
|
|
@@ -630,33 +616,6 @@ export async function getAuditFile( req, res ) {
|
|
|
630
616
|
file_path: msg.changed } ) : '',
|
|
631
617
|
},
|
|
632
618
|
];
|
|
633
|
-
break;
|
|
634
|
-
case 'uniform-detection':
|
|
635
|
-
const files = [];
|
|
636
|
-
|
|
637
|
-
const params ={
|
|
638
|
-
Bucket: msg.inputBucketName,
|
|
639
|
-
Key: msg?.filePath,
|
|
640
|
-
};
|
|
641
|
-
|
|
642
|
-
const isExists = await checkFileExist( params );
|
|
643
|
-
|
|
644
|
-
if ( isExists ) {
|
|
645
|
-
const signedParams ={
|
|
646
|
-
Bucket: msg.inputBucketName,
|
|
647
|
-
file_path: msg?.filePath,
|
|
648
|
-
};
|
|
649
|
-
const data = await signedUrl( signedParams );
|
|
650
|
-
|
|
651
|
-
files.push(
|
|
652
|
-
data,
|
|
653
|
-
);
|
|
654
|
-
}
|
|
655
|
-
result.push( {
|
|
656
|
-
type: 'image',
|
|
657
|
-
file: files,
|
|
658
|
-
} );
|
|
659
|
-
|
|
660
619
|
break;
|
|
661
620
|
case 'unattended-customer':
|
|
662
621
|
case 'left-in-middle':
|
|
@@ -749,9 +708,7 @@ export async function getAuditFile( req, res ) {
|
|
|
749
708
|
|
|
750
709
|
const record = {
|
|
751
710
|
userId: req.user._id,
|
|
752
|
-
storeId: msg.storeId,
|
|
753
711
|
clientId: storeInfo?.clientId,
|
|
754
|
-
fileDate: msg.fileDate,
|
|
755
712
|
queueName: inputData.queueName,
|
|
756
713
|
auditStatus: 'inprogress',
|
|
757
714
|
auditType: 'Audit',
|
|
@@ -760,7 +717,6 @@ export async function getAuditFile( req, res ) {
|
|
|
760
717
|
startTime: new Date(),
|
|
761
718
|
tempId: msg.tempId,
|
|
762
719
|
fileDetails: msg.fileDetails,
|
|
763
|
-
moduleType: inputData.moduleType,
|
|
764
720
|
inputBucketName: msg.inputBucketName,
|
|
765
721
|
question: msg.question,
|
|
766
722
|
questionType: msg.questionType,
|
|
@@ -775,7 +731,48 @@ export async function getAuditFile( req, res ) {
|
|
|
775
731
|
'inspectHourCount': msg.inspectHourCount,
|
|
776
732
|
'endHourCount': msg.inspectHourCount,
|
|
777
733
|
} : {};
|
|
778
|
-
|
|
734
|
+
|
|
735
|
+
let getQuery = {};
|
|
736
|
+
switch ( inputData.moduleType ) {
|
|
737
|
+
case 'unattended-customer':
|
|
738
|
+
getQuery ={
|
|
739
|
+
storeId: msg.storeId,
|
|
740
|
+
fileDate: msg.fileDate,
|
|
741
|
+
tempId: msg.tempId,
|
|
742
|
+
moduleType: inputData.moduleType,
|
|
743
|
+
};
|
|
744
|
+
break;
|
|
745
|
+
case 'left-in-middle':
|
|
746
|
+
getQuery ={
|
|
747
|
+
storeId: msg.storeId,
|
|
748
|
+
fileDate: msg.fileDate,
|
|
749
|
+
question: msg.question,
|
|
750
|
+
moduleType: inputData.moduleType,
|
|
751
|
+
};
|
|
752
|
+
break;
|
|
753
|
+
case 'camera-angle-change':
|
|
754
|
+
case 'eye-test-camera':
|
|
755
|
+
getQuery ={
|
|
756
|
+
storeId: msg.storeId,
|
|
757
|
+
fileDate: msg.fileDate,
|
|
758
|
+
streamName: msg.streamName,
|
|
759
|
+
moduleType: inputData.moduleType,
|
|
760
|
+
};
|
|
761
|
+
break;
|
|
762
|
+
case 'cleaning':
|
|
763
|
+
case 'scrum':
|
|
764
|
+
getQuery ={
|
|
765
|
+
storeId: msg.storeId,
|
|
766
|
+
fileDate: msg.fileDate,
|
|
767
|
+
moduleType: inputData.moduleType,
|
|
768
|
+
};
|
|
769
|
+
break;
|
|
770
|
+
default:
|
|
771
|
+
return res.sendError( 'Please give valid moduleType', 400 );
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
await updateOneUpsertBinaryAudit( getQuery, record );
|
|
775
|
+
insertData = await findOneBinaryAudit( getQuery );
|
|
779
776
|
} else {
|
|
780
777
|
insertData = userDetails[0];
|
|
781
778
|
}
|
|
@@ -1090,6 +1087,7 @@ export async function saveBinary( req, res ) {
|
|
|
1090
1087
|
fileDate: inputData.fileDate,
|
|
1091
1088
|
moduleType: inputData.moduleType,
|
|
1092
1089
|
Answer: inputData.answer,
|
|
1090
|
+
configTime: getFilePath?.sqs?.Body?.configTime,
|
|
1093
1091
|
inputBucketName: getFilePath?.sqs?.Body?.inputBucketName,
|
|
1094
1092
|
folderPath: [ 'cleaning', 'scrum' ].includes( inputData.moduleType ) ? getFilePath?.sqs?.Body?.fileDetails[0]?.outputFilePath : folderPath.split( '/' ).slice( 0, -1 ).join( '/' ) + '/',
|
|
1095
1093
|
createdAt: new Date(),
|
|
@@ -4313,7 +4311,7 @@ export async function getDetectionAuditFile( req, res ) {
|
|
|
4313
4311
|
} else {
|
|
4314
4312
|
logger.error( {
|
|
4315
4313
|
error: { folderPath: folderPath, nextQuery: nextQuery },
|
|
4316
|
-
function: `
|
|
4314
|
+
function: `geDetectiontAuditFile - ${inputData.moduleType }`,
|
|
4317
4315
|
message: 'Bucket image data not availale',
|
|
4318
4316
|
} );
|
|
4319
4317
|
return res.sendError( 'Bucket is Empty', 204 );
|
|
@@ -16,3 +16,7 @@ export function findOneBinaryAudit( query ) {
|
|
|
16
16
|
export function updateOneBinaryAuditModel( query, record ) {
|
|
17
17
|
return binaryAuditModel.updateOne( query, { $set: record } );
|
|
18
18
|
}
|
|
19
|
+
|
|
20
|
+
export function updateOneUpsertBinaryAudit( query, record ) {
|
|
21
|
+
return binaryAuditModel.updateOne( query, { $set: record }, { upsert: true } );
|
|
22
|
+
}
|