tango-app-api-trax 3.3.1-beta-71 → 3.3.1-beta-73

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-trax",
3
- "version": "3.3.1-beta-71",
3
+ "version": "3.3.1-beta-73",
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.61",
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
- let planoDetails = await planoService.findOne( { storeId: element4.store_id, clientId: getCLconfig.client_id }, { _id: 1 } );
570
- element4.planoId = planoDetails?._id;
571
- element4.isPlano = getCLconfig?.isPlano;
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
  }
@@ -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, getChecklistUsers } from 'tango-app-api-middleware';
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: getUserEmails } } ] },
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: getUserEmails } } ] },
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: getUserEmails } } ] },
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: getUserEmails } }, { aiStoreList: { $in: storeId } } ],
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: getUserEmails } }, { aiStoreList: { $in: requestData.storeId } } ],
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: getUserEmails } }, { aiStoreList: { $in: requestData.storeId } } ] },
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
- $addToSet: {
863
- $cond: [
864
- {
865
- $or: [
866
- { $gt: [ '$timeFlag', 0 ] },
867
- { $gt: [ '$questionFlag', 0 ] },
868
- { $gt: [ '$mobileDetectionFlag', 0 ] },
869
- { $gt: [ '$storeOpenCloseFlag', 0 ] },
870
- { $gt: [ '$uniformDetectionFlag', 0 ] },
871
- { $gt: [ '$customerUnattended', 0 ] },
872
- { $gt: [ '$staffLeftInTheMiddle', 0 ] },
873
- ],
874
- },
875
- '$store_id',
876
- '$$REMOVE',
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: '$storeCountAi',
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: getUserEmails } } ] },
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: getUserEmails } } ],
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: getUserEmails } } ] },
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: getUserEmails } } ] },
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: getUserEmails } } ],
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: getUserEmails } } ],
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: getUserEmails } } ] },
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: getUserEmails } }, { aiStoreList: { $in: requestData.storeId } } ] },
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
  {
@@ -1989,17 +1989,15 @@ export const validateUserv1 = async ( req, res ) => {
1989
1989
  };
1990
1990
  } else {
1991
1991
  if ( acc[obj.userEmail.toLowerCase()] ) {
1992
- if ( acc[obj.userEmail.toLowerCase()].name.includes( obj.userName.toLowerCase() ) ) {
1993
- acc[obj.userEmail.toLowerCase()].count++;
1994
- } else {
1995
- acc[obj.userEmail.toLowerCase()].name.push( obj.userEmail.toLowerCase() );
1996
- }
1992
+ acc[obj.userEmail.toLowerCase()].name.push( obj.userName.toLowerCase() );
1993
+ acc[obj.userEmail.toLowerCase()].count++;
1997
1994
  }
1998
1995
  }
1999
1996
  return acc;
2000
1997
  }, {} );
2001
1998
 
2002
1999
  const duplicateUsers = Object.keys( duplicateUser ).filter( ( storeName ) => duplicateUser[storeName].count > 1 );
2000
+ console.log( duplicateUsers, 'user' );
2003
2001
  if ( duplicateUsers.length ) {
2004
2002
  return res.sendError( { validate: false, duplicates: duplicateUsers, message: 'Email is Duplicated' }, 400 );
2005
2003
  }
@@ -2553,6 +2551,7 @@ export async function insertSingleProcessData( checklistId, processId = 0, oldDa
2553
2551
  insertdata.remainder = getCLconfig?.remainder || [];
2554
2552
  insertdata.restrictAttendance = getCLconfig?.restrictAttendance;
2555
2553
  insertdata.coverage = getCLconfig?.coverage;
2554
+ insertdata.rawImageUpload = getCLconfig?.rawImageUpload || false;
2556
2555
 
2557
2556
  let collectSections = [];
2558
2557
  let sectionQuery = [];
@@ -3264,6 +3263,7 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
3264
3263
  element4.remainder = getCLconfig?.remainder || [];
3265
3264
  element4.restrictAttendance = getCLconfig?.restrictAttendance;
3266
3265
  element4.coverage = getCLconfig?.coverage;
3266
+ element4.rawImageUpload = getCLconfig?.rawImageUpload || false;
3267
3267
  assignUserList.push( { ...element4 } );
3268
3268
  }
3269
3269
  } ) );
@@ -3318,16 +3318,11 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
3318
3318
 
3319
3319
  await processedchecklist.deleteMany( { userEmail: { $nin: userList }, date_string: insertdata.date_string, date_iso: insertdata.date_iso, client_id: insertdata.client_id, checkListId: updatedchecklist._id, checklistStatus: { $nin: [ 'submit' ] } } );
3320
3320
  if ( getCLconfig.coverage == 'store' ) {
3321
- await Promise.all( assignUserList.map( async ( item ) => {
3322
- if ( unAssignedList.hasOwnProperty( item.userEmail ) ) {
3323
- await processedchecklist.deleteMany( { date_string: insertdata.date_string, date_iso: insertdata.date_iso, client_id: insertdata.client_id, checkListId: updatedchecklist._id, $and: [ { userEmail: item.userEmail }, { store_id: { $nin: unAssignedList[item.userEmail] } } ], checklistStatus: { $nin: [ 'submit' ] } } );
3321
+ for ( let key in unAssignedList ) {
3322
+ if ( unAssignedList.hasOwnProperty( key ) ) {
3323
+ await processedchecklist.deleteMany( { date_string: insertdata.date_string, date_iso: insertdata.date_iso, client_id: insertdata.client_id, checkListId: updatedchecklist._id, $and: [ { userEmail: key }, { store_id: { $nin: unAssignedList[key] } } ], checklistStatus: { $nin: [ 'submit' ] } } );
3324
3324
  }
3325
- } ) );
3326
- // for ( let key in unAssignedList ) {
3327
- // if ( unAssignedList.hasOwnProperty( key ) ) {
3328
- // await processedchecklist.deleteMany( { date_string: insertdata.date_string, date_iso: insertdata.date_iso, client_id: insertdata.client_id, checkListId: updatedchecklist._id, $and: [ { userEmail: key }, { store_id: { $nin: unAssignedList[key] } } ], checklistStatus: { $nin: [ 'submit' ] } } );
3329
- // }
3330
- // }
3325
+ }
3331
3326
  }
3332
3327
 
3333
3328
  let inprogressData = await processedchecklist.find( {