tango-app-api-trax 3.3.1-beta-72 → 3.3.1-beta-74
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 +2 -2
- package/src/controllers/internalTrax.controller.js +10 -7
- package/src/controllers/mobileTrax.controller.js +12 -11
- package/src/controllers/teaxFlag.controller.js +71 -53
- package/src/controllers/trax.controller.js +2 -0
- package/src/controllers/traxDashboard.controllers.js +47 -47
- package/src/dtos/dashboardValidation.dtos.js +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-trax",
|
|
3
|
-
"version": "3.3.1-beta-
|
|
3
|
+
"version": "3.3.1-beta-74",
|
|
4
4
|
"description": "Trax",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"mongodb": "^6.8.0",
|
|
27
27
|
"nodemon": "^3.1.4",
|
|
28
28
|
"path": "^0.12.7",
|
|
29
|
-
"tango-api-schema": "^2.2.
|
|
29
|
+
"tango-api-schema": "^2.2.67",
|
|
30
30
|
"tango-app-api-middleware": "^3.1.55",
|
|
31
31
|
"url": "^0.11.4",
|
|
32
32
|
"winston": "^3.13.1",
|
|
@@ -19,7 +19,7 @@ import utc from 'dayjs/plugin/utc.js';
|
|
|
19
19
|
import { logger } from 'tango-app-api-middleware';
|
|
20
20
|
import mongoose from 'mongoose';
|
|
21
21
|
import { sendPushNotification } from 'tango-app-api-middleware';
|
|
22
|
-
import * as planoService from '../services/planogram.service.js';
|
|
22
|
+
// import * as planoService from '../services/planogram.service.js';
|
|
23
23
|
import * as clusterServices from '../services/cluster.service.js';
|
|
24
24
|
import * as teamsServices from '../services/teams.service.js';
|
|
25
25
|
|
|
@@ -294,6 +294,7 @@ async function insertData( requestData ) {
|
|
|
294
294
|
insertdata.locationCount = getCLconfig.locationCount;
|
|
295
295
|
insertdata.scheduleRepeatedType = getCLconfig.scheduleRepeatedType;
|
|
296
296
|
insertdata.allowedMultiSubmit = getCLconfig.allowedMultiSubmit;
|
|
297
|
+
insertdata.rawImageUpload = getCLconfig.rawImageUpload || false;
|
|
297
298
|
let collectSections = [];
|
|
298
299
|
let sectionQuery = [];
|
|
299
300
|
sectionQuery.push( {
|
|
@@ -565,11 +566,12 @@ async function insertData( requestData ) {
|
|
|
565
566
|
element4.scheduleRepeatedType = getCLconfig.scheduleRepeatedType;
|
|
566
567
|
element4.approvalEnable = getCLconfig.approver.length ? true : false;
|
|
567
568
|
element4.remainder = getCLconfig?.remainder || [];
|
|
568
|
-
if ( getCLconfig?.isPlano ) {
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
}
|
|
569
|
+
// if ( getCLconfig?.isPlano ) {
|
|
570
|
+
// let planoDetails = await planoService.findOne( { storeId: element4.store_id, clientId: getCLconfig.client_id }, { _id: 1 } );
|
|
571
|
+
// element4.planoId = planoDetails?._id;
|
|
572
|
+
// element4.isPlano = getCLconfig?.isPlano;
|
|
573
|
+
// }
|
|
574
|
+
element4.rawImageUpload = getCLconfig?.rawImageUpload || false;
|
|
573
575
|
}
|
|
574
576
|
if ( userIdList.length ) {
|
|
575
577
|
allQuestion = allQuestion.filter( ( item ) => typeof item._id == 'undefined' );
|
|
@@ -622,7 +624,8 @@ async function insertData( requestData ) {
|
|
|
622
624
|
client_id: getCLconfig.client_id,
|
|
623
625
|
aiStoreList: storeDetails ? storeDetails.map( ( store ) => store.storeId ) : [],
|
|
624
626
|
};
|
|
625
|
-
await processedchecklist.create( data );
|
|
627
|
+
// await processedchecklist.create( data );
|
|
628
|
+
await processedchecklist.updateOne( { date_string: currentdate, checkListId: updatedchecklist._id, sourceCheckList_id: getCLconfig._id, checkListType: getCLconfig.checkListType }, data );
|
|
626
629
|
}
|
|
627
630
|
}
|
|
628
631
|
}
|
|
@@ -710,7 +710,7 @@ export async function sopMobilechecklistMultiSectionFormatter( req, res, next )
|
|
|
710
710
|
structure.parentanswer = requestSection[i].parentanswer;
|
|
711
711
|
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
712
712
|
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
713
|
-
structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
713
|
+
// structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
714
714
|
if ( qaAnswers[j]?.taskId ) {
|
|
715
715
|
structure.taskId = qaAnswers[j]?.taskId;
|
|
716
716
|
structure.task = true;
|
|
@@ -762,7 +762,7 @@ export async function sopMobilechecklistMultiSectionFormatter( req, res, next )
|
|
|
762
762
|
structure.parentanswer = requestSection[i].parentanswer;
|
|
763
763
|
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
764
764
|
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
765
|
-
structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
765
|
+
// structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
766
766
|
if ( qaAnswers[j]?.taskId ) {
|
|
767
767
|
structure.taskId = qaAnswers[j]?.taskId;
|
|
768
768
|
structure.task = true;
|
|
@@ -818,7 +818,7 @@ export async function sopMobilechecklistMultiSectionFormatter( req, res, next )
|
|
|
818
818
|
structure.parentanswer = requestSection[i].parentanswer;
|
|
819
819
|
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
820
820
|
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
821
|
-
structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
821
|
+
// structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
822
822
|
if ( qaAnswers[j]?.taskId ) {
|
|
823
823
|
structure.taskId = qaAnswers[j]?.taskId;
|
|
824
824
|
structure.task = true;
|
|
@@ -879,7 +879,7 @@ export async function sopMobilechecklistMultiSectionFormatter( req, res, next )
|
|
|
879
879
|
structure.parentanswer = requestSection[i].parentanswer;
|
|
880
880
|
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
881
881
|
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
882
|
-
structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
882
|
+
// structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
883
883
|
if ( qaAnswers[j]?.taskId ) {
|
|
884
884
|
structure.taskId = qaAnswers[j]?.taskId;
|
|
885
885
|
structure.task = true;
|
|
@@ -938,7 +938,7 @@ export async function sopMobilechecklistMultiSectionFormatter( req, res, next )
|
|
|
938
938
|
structure.parentanswer = requestSection[i].parentanswer;
|
|
939
939
|
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
940
940
|
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
941
|
-
structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
941
|
+
// structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
942
942
|
if ( qaAnswers[j]?.taskId ) {
|
|
943
943
|
structure.taskId = qaAnswers[j]?.taskId;
|
|
944
944
|
structure.task = true;
|
|
@@ -1062,7 +1062,7 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
|
|
|
1062
1062
|
let requestSection = reqAnswers.filter( ( item ) => item.section_id == section.id );
|
|
1063
1063
|
for ( let i = 0; i < requestSection.length; i++ ) {
|
|
1064
1064
|
for ( let j = 0; j < qaAnswers.length; j++ ) {
|
|
1065
|
-
if (
|
|
1065
|
+
if ( requestSection[i].qname == qaAnswers[j].oldQname || requestSection[i].qname == qaAnswers[j].qname ) {
|
|
1066
1066
|
if ( qaAnswers[j].answerType == 'yes/no' ) {
|
|
1067
1067
|
let qaans = qaAnswers[j].answers;
|
|
1068
1068
|
let yn = [];
|
|
@@ -1101,7 +1101,7 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
|
|
|
1101
1101
|
structure.parentanswer = requestSection[i].parentanswer;
|
|
1102
1102
|
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
1103
1103
|
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
1104
|
-
structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
1104
|
+
// structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
1105
1105
|
structure.oldQname = qaAnswers[j]?.oldQname || qaAnswers[j].qname;
|
|
1106
1106
|
if ( qaAnswers[j]?.taskId ) {
|
|
1107
1107
|
structure.taskId = qaAnswers[j]?.taskId;
|
|
@@ -1154,7 +1154,7 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
|
|
|
1154
1154
|
structure.parentanswer = requestSection[i].parentanswer;
|
|
1155
1155
|
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
1156
1156
|
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
1157
|
-
structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
1157
|
+
// structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
1158
1158
|
structure.oldQname = qaAnswers[j]?.oldQname || qaAnswers[j].qname;
|
|
1159
1159
|
if ( qaAnswers[j]?.taskId ) {
|
|
1160
1160
|
structure.taskId = qaAnswers[j]?.taskId;
|
|
@@ -1211,7 +1211,7 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
|
|
|
1211
1211
|
structure.parentanswer = requestSection[i].parentanswer;
|
|
1212
1212
|
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
1213
1213
|
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
1214
|
-
structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
1214
|
+
// structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
1215
1215
|
structure.oldQname = qaAnswers[j]?.oldQname || qaAnswers[j].qname;
|
|
1216
1216
|
if ( qaAnswers[j]?.taskId ) {
|
|
1217
1217
|
structure.taskId = qaAnswers[j]?.taskId;
|
|
@@ -1273,7 +1273,7 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
|
|
|
1273
1273
|
structure.parentanswer = requestSection[i].parentanswer;
|
|
1274
1274
|
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
1275
1275
|
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
1276
|
-
structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
1276
|
+
// structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
1277
1277
|
structure.oldQname = qaAnswers[j]?.oldQname || qaAnswers[j].qname;
|
|
1278
1278
|
if ( qaAnswers[j]?.taskId ) {
|
|
1279
1279
|
structure.taskId = qaAnswers[j]?.taskId;
|
|
@@ -1333,7 +1333,7 @@ export async function sopMobilechecklistMultiSectionFormatterv1( req, res, next
|
|
|
1333
1333
|
structure.parentanswer = requestSection[i].parentanswer;
|
|
1334
1334
|
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
1335
1335
|
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
1336
|
-
structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
1336
|
+
// structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
1337
1337
|
structure.oldQname = qaAnswers[j]?.oldQname || qaAnswers[j].qname;
|
|
1338
1338
|
if ( qaAnswers[j]?.taskId ) {
|
|
1339
1339
|
structure.taskId = qaAnswers[j]?.taskId;
|
|
@@ -2556,6 +2556,7 @@ export async function questionList( req, res ) {
|
|
|
2556
2556
|
userEmail: { $ifNull: [ '$userEmail', '' ] },
|
|
2557
2557
|
storeName: { $ifNull: [ '$storeName', '' ] },
|
|
2558
2558
|
redoStatus: { $ifNull: [ '$redoStatus', false ] },
|
|
2559
|
+
rawImageUpload: { $ifNull: [ '$rawImageUpload', false ] },
|
|
2559
2560
|
},
|
|
2560
2561
|
} );
|
|
2561
2562
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { download, logger
|
|
1
|
+
import { download, logger } from 'tango-app-api-middleware'; // getChecklistUsers
|
|
2
2
|
import { aggregate } from '../services/processedchecklist.services.js';
|
|
3
3
|
import dayjs from 'dayjs';
|
|
4
4
|
import * as processedchecklistService from '../services/processedchecklist.services.js';
|
|
@@ -14,8 +14,8 @@ export const overallFlagMetrics = async ( req, res ) => {
|
|
|
14
14
|
try {
|
|
15
15
|
let requestData = req.body;
|
|
16
16
|
// Get User Based Checklist //
|
|
17
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
18
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
17
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
18
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
19
19
|
// End: Get User Based Checklist////
|
|
20
20
|
const pipeline = [
|
|
21
21
|
{
|
|
@@ -28,7 +28,7 @@ export const overallFlagMetrics = async ( req, res ) => {
|
|
|
28
28
|
{ date_iso: { $gte: new Date( req.body.startDate ) } },
|
|
29
29
|
{ date_iso: { $lte: new Date( req.body.endDate ) } },
|
|
30
30
|
// { store_id: { $in: req.body.stores } },
|
|
31
|
-
{ $or: [ { store_id: { $in: req.body.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
31
|
+
{ $or: [ { store_id: { $in: req.body.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
32
32
|
],
|
|
33
33
|
},
|
|
34
34
|
},
|
|
@@ -105,7 +105,7 @@ export const overallFlagMetrics = async ( req, res ) => {
|
|
|
105
105
|
{ date_iso: { $gte: dayjs.utc( req.body.endDate ).subtract( 7, 'days' ).startOf( 'day' ).toDate() } },
|
|
106
106
|
{ date_iso: { $lte: dayjs.utc( req.body.startDate ).subtract( 1, 'day' ).startOf( 'day' ).toDate() } },
|
|
107
107
|
// { store_id: { $in: req.body.stores } },
|
|
108
|
-
{ $or: [ { store_id: { $in: req.body.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
108
|
+
{ $or: [ { store_id: { $in: req.body.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
109
109
|
],
|
|
110
110
|
},
|
|
111
111
|
},
|
|
@@ -256,8 +256,8 @@ export const checklistFlagsTable = async ( req, res ) => {
|
|
|
256
256
|
try {
|
|
257
257
|
let requestData = req.body;
|
|
258
258
|
// Get User Based Checklist //
|
|
259
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
260
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
259
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
260
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
261
261
|
// End: Get User Based Checklist////
|
|
262
262
|
const matchStage = {
|
|
263
263
|
$match: {
|
|
@@ -273,7 +273,7 @@ export const checklistFlagsTable = async ( req, res ) => {
|
|
|
273
273
|
{ uniformDetectionFlag: { $gt: 0 } },
|
|
274
274
|
] },
|
|
275
275
|
// { store_id: { $in: req.body.stores } },
|
|
276
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
276
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
277
277
|
],
|
|
278
278
|
},
|
|
279
279
|
};
|
|
@@ -537,8 +537,8 @@ export const flagCardsV1 = async ( req, res ) => {
|
|
|
537
537
|
|
|
538
538
|
let requestData = req.body;
|
|
539
539
|
// Get User Based Checklist //
|
|
540
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
541
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
540
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
541
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
542
542
|
// End: Get User Based Checklist////
|
|
543
543
|
const findQuery = [
|
|
544
544
|
{
|
|
@@ -546,7 +546,7 @@ export const flagCardsV1 = async ( req, res ) => {
|
|
|
546
546
|
client_id: clientId,
|
|
547
547
|
// $or: [ { store_id: { $in: storeId } }, { aiStoreList: { $in: storeId } } ],
|
|
548
548
|
date_iso: { $gte: adjustedFromDate, $lte: adjustedToDate },
|
|
549
|
-
$or: [ { store_id: { $in: storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
549
|
+
$or: [ { store_id: { $in: storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } }, { aiStoreList: { $in: storeId } } ],
|
|
550
550
|
},
|
|
551
551
|
},
|
|
552
552
|
{
|
|
@@ -678,14 +678,14 @@ export const flagComparisonCardsV1 = async ( req, res ) => {
|
|
|
678
678
|
}
|
|
679
679
|
|
|
680
680
|
// Get User Based Checklist //
|
|
681
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
682
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
681
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
682
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
683
683
|
// End: Get User Based Checklist////
|
|
684
684
|
const createFindQuery = ( fromDate, toDate ) => [
|
|
685
685
|
{ $match: { client_id: requestData.clientId,
|
|
686
686
|
// $or: [ { store_id: { $in: requestData.storeId } }, { aiStoreList: { $in: requestData.storeId } } ],
|
|
687
687
|
date_iso: { $gte: fromDate, $lte: toDate },
|
|
688
|
-
$or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
688
|
+
$or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } }, { aiStoreList: { $in: requestData.storeId } } ],
|
|
689
689
|
} },
|
|
690
690
|
{
|
|
691
691
|
$project: {
|
|
@@ -794,8 +794,8 @@ export const flagTablesV1 = async ( req, res ) => {
|
|
|
794
794
|
let result = {};
|
|
795
795
|
|
|
796
796
|
// Get User Based Checklist //
|
|
797
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
798
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
797
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
798
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
799
799
|
// End: Get User Based Checklist////
|
|
800
800
|
|
|
801
801
|
let findQuery = [];
|
|
@@ -804,11 +804,12 @@ export const flagTablesV1 = async ( req, res ) => {
|
|
|
804
804
|
{ client_id: requestData.clientId },
|
|
805
805
|
// { $or: [ { store_id: { $in: requestData.storeId } }, { aiStoreList: { $in: requestData.storeId } } ] },
|
|
806
806
|
{ date_iso: { $gte: fromDate, $lte: toDate } },
|
|
807
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
807
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } }, { aiStoreList: { $in: requestData.storeId } } ] },
|
|
808
808
|
);
|
|
809
809
|
|
|
810
810
|
if ( requestData?.filter === 'all' ) {
|
|
811
|
-
findAndQuery.push( { $or: [ { questionFlag: { $gte: 1 } }, { timeFlag: { $gte: 1 } }, { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection' ] } } ] } );
|
|
811
|
+
// findAndQuery.push( { $or: [ { questionFlag: { $gte: 1 } }, { timeFlag: { $gte: 1 } }, { checkListType: { $in: [ 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection' ] } } ] } );
|
|
812
|
+
findAndQuery.push( { $or: [ { checkListType: { $in: [ 'custom', 'customerunattended', 'mobileusagedetection', 'staffleftinthemiddle', 'storeopenandclose', 'uniformdetection' ] } } ] } );
|
|
812
813
|
} else if ( requestData?.filter === 'question' ) {
|
|
813
814
|
findAndQuery.push( { checkListType: 'custom' } );
|
|
814
815
|
findAndQuery.push( { questionFlag: { $gte: 1 } } );
|
|
@@ -858,25 +859,40 @@ export const flagTablesV1 = async ( req, res ) => {
|
|
|
858
859
|
checkListType: { $last: '$checkListType' },
|
|
859
860
|
storeCount: { $sum: 1 },
|
|
860
861
|
storeCountAi: { $max: '$storeCount' },
|
|
861
|
-
flaggedStores: {
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
862
|
+
// flaggedStores: {
|
|
863
|
+
// $addToSet: {
|
|
864
|
+
// $cond: [
|
|
865
|
+
// {
|
|
866
|
+
// $or: [
|
|
867
|
+
// { $gt: [ '$timeFlag', 0 ] },
|
|
868
|
+
// { $gt: [ '$questionFlag', 0 ] },
|
|
869
|
+
// { $gt: [ '$mobileDetectionFlag', 0 ] },
|
|
870
|
+
// { $gt: [ '$storeOpenCloseFlag', 0 ] },
|
|
871
|
+
// { $gt: [ '$uniformDetectionFlag', 0 ] },
|
|
872
|
+
// { $gt: [ '$customerUnattended', 0 ] },
|
|
873
|
+
// { $gt: [ '$staffLeftInTheMiddle', 0 ] },
|
|
874
|
+
// ],
|
|
875
|
+
// },
|
|
876
|
+
// '$store_id',
|
|
877
|
+
// '$$REMOVE',
|
|
878
|
+
// ],
|
|
879
|
+
// },
|
|
880
|
+
// },
|
|
881
|
+
flaggedStores: { $sum: { $cond: [
|
|
882
|
+
{
|
|
883
|
+
$or: [
|
|
884
|
+
{ '$gt': [ '$timeFlag', 0 ] },
|
|
885
|
+
{ '$gt': [ '$questionFlag', 0 ] },
|
|
886
|
+
{ '$gt': [ '$mobileDetectionFlag', 0 ] },
|
|
887
|
+
{ '$gt': [ '$storeOpenCloseFlag', 0 ] },
|
|
888
|
+
{ '$gt': [ '$uniformDetectionFlag', 0 ] },
|
|
889
|
+
{ '$gt': [ '$customerUnattended', 0 ] },
|
|
890
|
+
{ '$gt': [ '$staffLeftInTheMiddle', 0 ] },
|
|
877
891
|
],
|
|
878
892
|
},
|
|
879
|
-
|
|
893
|
+
1,
|
|
894
|
+
0,
|
|
895
|
+
] } },
|
|
880
896
|
flagCount: {
|
|
881
897
|
$sum: {
|
|
882
898
|
$add: [ '$questionFlag', '$timeFlag' ],
|
|
@@ -914,6 +930,7 @@ export const flagTablesV1 = async ( req, res ) => {
|
|
|
914
930
|
// },
|
|
915
931
|
},
|
|
916
932
|
aiStoreList: { $max: '$aiStoreList' },
|
|
933
|
+
aiStoreListNew: { $sum: { $size: '$aiStoreList' } },
|
|
917
934
|
submittedQuestionCount: {
|
|
918
935
|
$sum: {
|
|
919
936
|
$cond: [
|
|
@@ -929,7 +946,7 @@ export const flagTablesV1 = async ( req, res ) => {
|
|
|
929
946
|
findQuery.push( {
|
|
930
947
|
$project: {
|
|
931
948
|
assignedStores: '$storeCount',
|
|
932
|
-
assignedStoresAi: '$
|
|
949
|
+
assignedStoresAi: '$aiStoreListNew',
|
|
933
950
|
checkListName: 1,
|
|
934
951
|
coverage: 1,
|
|
935
952
|
checkListChar: 1,
|
|
@@ -937,7 +954,8 @@ export const flagTablesV1 = async ( req, res ) => {
|
|
|
937
954
|
checkListType: 1,
|
|
938
955
|
flagType: 1,
|
|
939
956
|
uniqueFlaggedStores: 1,
|
|
940
|
-
flaggedStores: { $size: '$flaggedStores' },
|
|
957
|
+
// flaggedStores: { $size: '$flaggedStores' },
|
|
958
|
+
flaggedStores: '$flaggedStores',
|
|
941
959
|
flagCount: 1,
|
|
942
960
|
questionCount: 1,
|
|
943
961
|
correctAnswers: { $subtract: [ '$submittedQuestionCount', '$questionFlag' ] },
|
|
@@ -1852,8 +1870,8 @@ export const flagChecklistCardsV1 = async ( req, res ) => {
|
|
|
1852
1870
|
try {
|
|
1853
1871
|
let reqestData = req.body;
|
|
1854
1872
|
// Get User Based Checklist //
|
|
1855
|
-
let loginUser = { clientId: reqestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
1856
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
1873
|
+
// let loginUser = { clientId: reqestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
1874
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
1857
1875
|
// End: Get User Based Checklist////
|
|
1858
1876
|
|
|
1859
1877
|
if ( reqestData.ChecklistType == 'custom' ) {
|
|
@@ -1866,7 +1884,7 @@ export const flagChecklistCardsV1 = async ( req, res ) => {
|
|
|
1866
1884
|
{ date_iso: { $lte: dayjs.utc( reqestData.toDate ).endOf( 'day' ).toDate() } },
|
|
1867
1885
|
{ sourceCheckList_id: new mongoose.Types.ObjectId( reqestData.sourceCheckList_id ) },
|
|
1868
1886
|
// { store_id: { $in: reqestData?.storeId } },
|
|
1869
|
-
{ $or: [ { store_id: { $in: reqestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
1887
|
+
{ $or: [ { store_id: { $in: reqestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: reqestData.userEmailes } } ] },
|
|
1870
1888
|
],
|
|
1871
1889
|
},
|
|
1872
1890
|
},
|
|
@@ -1970,7 +1988,7 @@ export const flagChecklistCardsV1 = async ( req, res ) => {
|
|
|
1970
1988
|
client_id: reqestData.clientId,
|
|
1971
1989
|
sourceCheckList_id: new mongoose.Types.ObjectId( reqestData.sourceCheckList_id ),
|
|
1972
1990
|
// store_id: { $in: reqestData.storeId },
|
|
1973
|
-
$or: [ { store_id: { $in: reqestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
1991
|
+
$or: [ { store_id: { $in: reqestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: reqestData.userEmailes } } ],
|
|
1974
1992
|
},
|
|
1975
1993
|
},
|
|
1976
1994
|
{
|
|
@@ -2073,8 +2091,8 @@ export const flagChecklistComparisonCardsV1 = async ( req, res ) => {
|
|
|
2073
2091
|
};
|
|
2074
2092
|
|
|
2075
2093
|
// Get User Based Checklist //
|
|
2076
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
2077
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
2094
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
2095
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
2078
2096
|
// End: Get User Based Checklist////
|
|
2079
2097
|
|
|
2080
2098
|
if ( requestData.ChecklistType == 'custom' ) {
|
|
@@ -2087,7 +2105,7 @@ export const flagChecklistComparisonCardsV1 = async ( req, res ) => {
|
|
|
2087
2105
|
{ date_iso: { $lte: rangeOneToDate } },
|
|
2088
2106
|
{ sourceCheckList_id: new mongoose.Types.ObjectId( requestData.sourceCheckList_id ) },
|
|
2089
2107
|
// { store_id: { $in: requestData?.storeId } },
|
|
2090
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
2108
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
2091
2109
|
],
|
|
2092
2110
|
},
|
|
2093
2111
|
},
|
|
@@ -2169,7 +2187,7 @@ export const flagChecklistComparisonCardsV1 = async ( req, res ) => {
|
|
|
2169
2187
|
{ date_iso: { $lte: rangeTwoToDate } },
|
|
2170
2188
|
{ sourceCheckList_id: new mongoose.Types.ObjectId( requestData.sourceCheckList_id ) },
|
|
2171
2189
|
// { store_id: { $in: requestData?.storeId } },
|
|
2172
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
2190
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
2173
2191
|
],
|
|
2174
2192
|
},
|
|
2175
2193
|
},
|
|
@@ -2283,7 +2301,7 @@ export const flagChecklistComparisonCardsV1 = async ( req, res ) => {
|
|
|
2283
2301
|
client_id: requestData.clientId,
|
|
2284
2302
|
sourceCheckList_id: new mongoose.Types.ObjectId( requestData.sourceCheckList_id ),
|
|
2285
2303
|
// store_id: { $in: requestData.storeId },
|
|
2286
|
-
$or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
2304
|
+
$or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ],
|
|
2287
2305
|
},
|
|
2288
2306
|
},
|
|
2289
2307
|
{
|
|
@@ -2309,7 +2327,7 @@ export const flagChecklistComparisonCardsV1 = async ( req, res ) => {
|
|
|
2309
2327
|
client_id: requestData.clientId,
|
|
2310
2328
|
sourceCheckList_id: new mongoose.Types.ObjectId( requestData.sourceCheckList_id ),
|
|
2311
2329
|
// store_id: { $in: requestData.storeId },
|
|
2312
|
-
$or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
2330
|
+
$or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ],
|
|
2313
2331
|
},
|
|
2314
2332
|
},
|
|
2315
2333
|
{
|
|
@@ -2353,8 +2371,8 @@ export const flagChecklistTableV1 = async ( req, res ) => {
|
|
|
2353
2371
|
try {
|
|
2354
2372
|
let reqestData = req.body;
|
|
2355
2373
|
// Get User Based Checklist //
|
|
2356
|
-
let loginUser = { clientId: reqestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
2357
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
2374
|
+
// let loginUser = { clientId: reqestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
2375
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
2358
2376
|
// End: Get User Based Checklist////
|
|
2359
2377
|
if ( reqestData.ChecklistType == 'custom' ) {
|
|
2360
2378
|
const match = {
|
|
@@ -2371,7 +2389,7 @@ export const flagChecklistTableV1 = async ( req, res ) => {
|
|
|
2371
2389
|
// ],
|
|
2372
2390
|
// },
|
|
2373
2391
|
// { store_id: { $in: reqestData?.storeId } },
|
|
2374
|
-
{ $or: [ { store_id: { $in: reqestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
2392
|
+
{ $or: [ { store_id: { $in: reqestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: reqestData.userEmailes } } ] },
|
|
2375
2393
|
],
|
|
2376
2394
|
},
|
|
2377
2395
|
};
|
|
@@ -2626,14 +2644,14 @@ export const checklistDropdownV1 = async ( req, res ) => {
|
|
|
2626
2644
|
let result = {};
|
|
2627
2645
|
|
|
2628
2646
|
// Get User Based Checklist //
|
|
2629
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
2630
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
2647
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
2648
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
2631
2649
|
// End: Get User Based Checklist////
|
|
2632
2650
|
|
|
2633
2651
|
let findQuery = [
|
|
2634
2652
|
{ $match: { $and: [
|
|
2635
2653
|
{ client_id: requestData.clientId },
|
|
2636
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
2654
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } }, { aiStoreList: { $in: requestData.storeId } } ] },
|
|
2637
2655
|
{ date_iso: { $gte: fromDate } },
|
|
2638
2656
|
{ date_iso: { $lte: toDate } },
|
|
2639
2657
|
{
|
|
@@ -2551,6 +2551,7 @@ export async function insertSingleProcessData( checklistId, processId = 0, oldDa
|
|
|
2551
2551
|
insertdata.remainder = getCLconfig?.remainder || [];
|
|
2552
2552
|
insertdata.restrictAttendance = getCLconfig?.restrictAttendance;
|
|
2553
2553
|
insertdata.coverage = getCLconfig?.coverage;
|
|
2554
|
+
insertdata.rawImageUpload = getCLconfig?.rawImageUpload || false;
|
|
2554
2555
|
|
|
2555
2556
|
let collectSections = [];
|
|
2556
2557
|
let sectionQuery = [];
|
|
@@ -3262,6 +3263,7 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
|
|
|
3262
3263
|
element4.remainder = getCLconfig?.remainder || [];
|
|
3263
3264
|
element4.restrictAttendance = getCLconfig?.restrictAttendance;
|
|
3264
3265
|
element4.coverage = getCLconfig?.coverage;
|
|
3266
|
+
element4.rawImageUpload = getCLconfig?.rawImageUpload || false;
|
|
3265
3267
|
assignUserList.push( { ...element4 } );
|
|
3266
3268
|
}
|
|
3267
3269
|
} ) );
|
|
@@ -278,8 +278,8 @@ export const checklistPerformance = async ( req, res ) => {
|
|
|
278
278
|
let result = {};
|
|
279
279
|
|
|
280
280
|
// Get User Based Checklist //
|
|
281
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
282
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
281
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
282
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
283
283
|
// End: Get User Based Checklist////
|
|
284
284
|
|
|
285
285
|
let findQuery = [];
|
|
@@ -289,7 +289,7 @@ export const checklistPerformance = async ( req, res ) => {
|
|
|
289
289
|
{ date_iso: { $gte: fromDate, $lte: toDate } },
|
|
290
290
|
{ client_id: requestData.clientId },
|
|
291
291
|
// { store_id: { $in: requestData.storeId } },
|
|
292
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
292
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
293
293
|
);
|
|
294
294
|
|
|
295
295
|
findQuery.push( { $match: { $and: findAndQuery } } );
|
|
@@ -463,8 +463,8 @@ export const storePerformance = async ( req, res ) => {
|
|
|
463
463
|
let result = {};
|
|
464
464
|
|
|
465
465
|
// Get User Based Checklist //
|
|
466
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
467
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
466
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
467
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
468
468
|
// End: Get User Based Checklist////
|
|
469
469
|
|
|
470
470
|
let findQuery = [];
|
|
@@ -475,7 +475,7 @@ export const storePerformance = async ( req, res ) => {
|
|
|
475
475
|
{ date_iso: { $lte: toDate } },
|
|
476
476
|
{ checkListType: { $eq: 'custom' } },
|
|
477
477
|
// { store_id: { $in: requestData.storeId } },
|
|
478
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
478
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
479
479
|
{ coverage: { $eq: 'store' } },
|
|
480
480
|
);
|
|
481
481
|
|
|
@@ -675,8 +675,8 @@ export const userPerformance = async ( req, res ) => {
|
|
|
675
675
|
let result = {};
|
|
676
676
|
|
|
677
677
|
// Get User Based Checklist //
|
|
678
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
679
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
678
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
679
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
680
680
|
// End: Get User Based Checklist////
|
|
681
681
|
|
|
682
682
|
let findQuery = [];
|
|
@@ -686,7 +686,7 @@ export const userPerformance = async ( req, res ) => {
|
|
|
686
686
|
{ checkListType: { $eq: 'custom' } },
|
|
687
687
|
{ client_id: requestData.clientId },
|
|
688
688
|
// { store_id: { $in: requestData.storeId } },
|
|
689
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
689
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
690
690
|
);
|
|
691
691
|
|
|
692
692
|
findQuery.push( { $match: { $and: findAndQuery } } );
|
|
@@ -950,8 +950,8 @@ export const storeDropdown = async ( req, res ) => {
|
|
|
950
950
|
let result = {};
|
|
951
951
|
|
|
952
952
|
// Get User Based Checklist //
|
|
953
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
954
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
953
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
954
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
955
955
|
// End: Get User Based Checklist////
|
|
956
956
|
|
|
957
957
|
let findQuery = [];
|
|
@@ -961,7 +961,7 @@ export const storeDropdown = async ( req, res ) => {
|
|
|
961
961
|
{ date_iso: { $gte: fromDate } },
|
|
962
962
|
{ date_iso: { $lte: toDate } },
|
|
963
963
|
// { store_id: { $in: requestData.storeId } },
|
|
964
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
964
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
965
965
|
);
|
|
966
966
|
|
|
967
967
|
findQuery.push( { $match: { $and: findAndQuery } } );
|
|
@@ -1073,8 +1073,8 @@ export const userDropdown = async ( req, res ) => {
|
|
|
1073
1073
|
let result = {};
|
|
1074
1074
|
|
|
1075
1075
|
// Get User Based Checklist //
|
|
1076
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
1077
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
1076
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
1077
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
1078
1078
|
// End: Get User Based Checklist////
|
|
1079
1079
|
|
|
1080
1080
|
let findQuery = [];
|
|
@@ -1084,7 +1084,7 @@ export const userDropdown = async ( req, res ) => {
|
|
|
1084
1084
|
{ date_iso: { $gte: fromDate } },
|
|
1085
1085
|
{ date_iso: { $lte: toDate } },
|
|
1086
1086
|
// { store_id: { $in: requestData.storeId } },
|
|
1087
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
1087
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
1088
1088
|
);
|
|
1089
1089
|
|
|
1090
1090
|
findQuery.push( { $match: { $and: findAndQuery } } );
|
|
@@ -1176,8 +1176,8 @@ export const checklistInfo = async ( req, res ) => {
|
|
|
1176
1176
|
let result = {};
|
|
1177
1177
|
|
|
1178
1178
|
// Get User Based Checklist //
|
|
1179
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
1180
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
1179
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
1180
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
1181
1181
|
// End: Get User Based Checklist////
|
|
1182
1182
|
|
|
1183
1183
|
let findQuery = [];
|
|
@@ -1188,7 +1188,7 @@ export const checklistInfo = async ( req, res ) => {
|
|
|
1188
1188
|
{ date_iso: { $lte: toDate } },
|
|
1189
1189
|
{ checkListType: { $eq: 'custom' } },
|
|
1190
1190
|
// { store_id: { $in: requestData.storeId } },
|
|
1191
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
1191
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
1192
1192
|
);
|
|
1193
1193
|
|
|
1194
1194
|
if ( requestData.checklistStatus && requestData.checklistStatus != 'All' ) {
|
|
@@ -1470,8 +1470,8 @@ export const infoCardsOld = async ( req, res ) => {
|
|
|
1470
1470
|
let result = {};
|
|
1471
1471
|
|
|
1472
1472
|
// Get User Based Checklist //
|
|
1473
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
1474
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
1473
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
1474
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
1475
1475
|
// End: Get User Based Checklist////
|
|
1476
1476
|
|
|
1477
1477
|
let findQuery = [];
|
|
@@ -1482,7 +1482,7 @@ export const infoCardsOld = async ( req, res ) => {
|
|
|
1482
1482
|
{ date_iso: { $gte: fromDate } },
|
|
1483
1483
|
{ date_iso: { $lte: toDate } },
|
|
1484
1484
|
// { store_id: { $in: requestData.storeId } },
|
|
1485
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
1485
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
1486
1486
|
);
|
|
1487
1487
|
|
|
1488
1488
|
if ( requestData.groupByType == 'checklist' ) {
|
|
@@ -1760,8 +1760,8 @@ export const flagDetectionCards = async ( req, res ) => {
|
|
|
1760
1760
|
let result = {};
|
|
1761
1761
|
|
|
1762
1762
|
// Get User Based Checklist //
|
|
1763
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
1764
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
1763
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
1764
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
1765
1765
|
// End: Get User Based Checklist////
|
|
1766
1766
|
|
|
1767
1767
|
let findQuery = [];
|
|
@@ -1772,7 +1772,7 @@ export const flagDetectionCards = async ( req, res ) => {
|
|
|
1772
1772
|
{ date_iso: { $gte: fromDate } },
|
|
1773
1773
|
{ date_iso: { $lte: toDate } },
|
|
1774
1774
|
// { store_id: { $in: requestData.storeId } },
|
|
1775
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
1775
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
1776
1776
|
);
|
|
1777
1777
|
findQuery.push( { $match: { $and: findAndQuery } } );
|
|
1778
1778
|
|
|
@@ -1923,8 +1923,8 @@ export const flagDetectionTables = async ( req, res ) => {
|
|
|
1923
1923
|
let result = {};
|
|
1924
1924
|
|
|
1925
1925
|
// Get User Based Checklist //
|
|
1926
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
1927
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
1926
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
1927
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
1928
1928
|
// End: Get User Based Checklist////
|
|
1929
1929
|
|
|
1930
1930
|
let findQuery = [];
|
|
@@ -1936,7 +1936,7 @@ export const flagDetectionTables = async ( req, res ) => {
|
|
|
1936
1936
|
{ date_iso: { $lte: toDate } },
|
|
1937
1937
|
{ checklistStatus: { $eq: 'submit' } },
|
|
1938
1938
|
// { store_id: { $in: requestData.storeId } },
|
|
1939
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
1939
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
1940
1940
|
);
|
|
1941
1941
|
|
|
1942
1942
|
findQuery.push( { $match: { $and: findAndQuery } } );
|
|
@@ -2270,8 +2270,8 @@ export const overallCardsV1 = async ( req, res ) => {
|
|
|
2270
2270
|
let result = {};
|
|
2271
2271
|
|
|
2272
2272
|
// Get User Based Checklist //
|
|
2273
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
2274
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
2273
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
2274
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
2275
2275
|
// End: Get User Based Checklist////
|
|
2276
2276
|
|
|
2277
2277
|
let findQuery = [];
|
|
@@ -2282,7 +2282,7 @@ export const overallCardsV1 = async ( req, res ) => {
|
|
|
2282
2282
|
{ date_iso: { $gte: fromDate, $lte: toDate } },
|
|
2283
2283
|
{ client_id: requestData.clientId },
|
|
2284
2284
|
// { store_id: { $in: requestData.storeId } },
|
|
2285
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
2285
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
2286
2286
|
);
|
|
2287
2287
|
|
|
2288
2288
|
findQuery.push( { $match: { $and: findAndQuery } } );
|
|
@@ -2520,8 +2520,8 @@ export const overallComparisonCardsV1 = async ( req, res ) => {
|
|
|
2520
2520
|
};
|
|
2521
2521
|
|
|
2522
2522
|
// Get User Based Checklist //
|
|
2523
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
2524
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
2523
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
2524
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
2525
2525
|
// End: Get User Based Checklist////
|
|
2526
2526
|
|
|
2527
2527
|
let rangeOneFindQuery = [];
|
|
@@ -2531,7 +2531,7 @@ export const overallComparisonCardsV1 = async ( req, res ) => {
|
|
|
2531
2531
|
{ date_iso: { $gte: rangeOneFromDate, $lte: rangeOneToDate } },
|
|
2532
2532
|
{ client_id: requestData.clientId },
|
|
2533
2533
|
// { store_id: { $in: requestData.storeId } },
|
|
2534
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
2534
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
2535
2535
|
);
|
|
2536
2536
|
|
|
2537
2537
|
rangeOneFindQuery.push( { $match: { $and: rangeOneFindAndQuery } } );
|
|
@@ -2629,7 +2629,7 @@ export const overallComparisonCardsV1 = async ( req, res ) => {
|
|
|
2629
2629
|
{ date_iso: { $gte: rangeTwoFromDate, $lte: rangeTwoToDate } },
|
|
2630
2630
|
{ client_id: requestData.clientId },
|
|
2631
2631
|
// { store_id: { $in: requestData.storeId } },
|
|
2632
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
2632
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
2633
2633
|
);
|
|
2634
2634
|
|
|
2635
2635
|
rangeTwoFindQuery.push( { $match: { $and: rangeTwoFindAndQuery } } );
|
|
@@ -2768,8 +2768,8 @@ export const infoCardsV1 = async ( req, res ) => {
|
|
|
2768
2768
|
let result = {};
|
|
2769
2769
|
|
|
2770
2770
|
// Get User Based Checklist //
|
|
2771
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
2772
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
2771
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
2772
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
2773
2773
|
// End: Get User Based Checklist////
|
|
2774
2774
|
|
|
2775
2775
|
let findQuery = [];
|
|
@@ -2781,7 +2781,7 @@ export const infoCardsV1 = async ( req, res ) => {
|
|
|
2781
2781
|
{ date_iso: { $lte: toDate } },
|
|
2782
2782
|
{ checkListType: { $eq: 'custom' } },
|
|
2783
2783
|
// { store_id: { $in: requestData.storeId } },
|
|
2784
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
2784
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
2785
2785
|
);
|
|
2786
2786
|
|
|
2787
2787
|
if ( requestData.groupByType == 'Checklist' ) {
|
|
@@ -3052,8 +3052,8 @@ export const infoComparisonCardsV1 = async ( req, res ) => {
|
|
|
3052
3052
|
};
|
|
3053
3053
|
|
|
3054
3054
|
// Get User Based Checklist //
|
|
3055
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
3056
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
3055
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
3056
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
3057
3057
|
// End: Get User Based Checklist////
|
|
3058
3058
|
|
|
3059
3059
|
let rangeOneFindQuery = [];
|
|
@@ -3064,7 +3064,7 @@ export const infoComparisonCardsV1 = async ( req, res ) => {
|
|
|
3064
3064
|
{ date_iso: { $lte: rangeOneToDate } },
|
|
3065
3065
|
{ checkListType: { $eq: 'custom' } },
|
|
3066
3066
|
// { store_id: { $in: requestData.storeId } },
|
|
3067
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
3067
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
3068
3068
|
);
|
|
3069
3069
|
|
|
3070
3070
|
if ( requestData.groupByType == 'Checklist' ) {
|
|
@@ -3183,7 +3183,7 @@ export const infoComparisonCardsV1 = async ( req, res ) => {
|
|
|
3183
3183
|
{ date_iso: { $lte: rangeTwoToDate } },
|
|
3184
3184
|
{ checkListType: { $eq: 'custom' } },
|
|
3185
3185
|
// { store_id: { $in: requestData.storeId } },
|
|
3186
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
3186
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
3187
3187
|
);
|
|
3188
3188
|
if ( requestData.groupByType == 'Checklist' ) {
|
|
3189
3189
|
rangeTwoFindAndQuery.push( { sourceCheckList_id: new mongoose.Types.ObjectId( requestData.groupByValue ) } );
|
|
@@ -3370,8 +3370,8 @@ export const monthlyGraphV1 = async ( req, res ) => {
|
|
|
3370
3370
|
let result = {};
|
|
3371
3371
|
|
|
3372
3372
|
// Get User Based Checklist //
|
|
3373
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
3374
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
3373
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
3374
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
3375
3375
|
// End: Get User Based Checklist////
|
|
3376
3376
|
|
|
3377
3377
|
let findQuery = [];
|
|
@@ -3382,7 +3382,7 @@ export const monthlyGraphV1 = async ( req, res ) => {
|
|
|
3382
3382
|
{ date_iso: { $lte: toDate } },
|
|
3383
3383
|
{ checkListType: { $eq: 'custom' } },
|
|
3384
3384
|
// { store_id: { $in: requestData.storeId } },
|
|
3385
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
3385
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
3386
3386
|
);
|
|
3387
3387
|
|
|
3388
3388
|
if ( requestData.groupByType == 'Checklist' ) {
|
|
@@ -3612,8 +3612,8 @@ export const checklistDropdown = async ( req, res ) => {
|
|
|
3612
3612
|
let result = {};
|
|
3613
3613
|
|
|
3614
3614
|
// Get User Based Checklist //
|
|
3615
|
-
let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
3616
|
-
let getUserEmails = await getChecklistUsers( loginUser );
|
|
3615
|
+
// let loginUser = { clientId: requestData.clientId, role: req.user.role, userType: req.user.userType, userEmail: req.user.email };
|
|
3616
|
+
// let getUserEmails = await getChecklistUsers( loginUser );
|
|
3617
3617
|
// End: Get User Based Checklist////
|
|
3618
3618
|
|
|
3619
3619
|
let findQuery = [
|
|
@@ -3622,7 +3622,7 @@ export const checklistDropdown = async ( req, res ) => {
|
|
|
3622
3622
|
{ date_iso: { $gte: fromDate, $lte: toDate } },
|
|
3623
3623
|
{ checkListType: 'custom' },
|
|
3624
3624
|
// { store_id: { $in: requestData.storeId } },
|
|
3625
|
-
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in:
|
|
3625
|
+
{ $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: requestData.userEmailes } } ] },
|
|
3626
3626
|
] } },
|
|
3627
3627
|
{
|
|
3628
3628
|
$project: {
|