tango-app-api-trax 3.3.1-beta-21 → 3.3.1-beta-23
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
|
@@ -397,6 +397,7 @@ export async function redoChecklist( req, res ) {
|
|
|
397
397
|
};
|
|
398
398
|
|
|
399
399
|
let response = await processedChecklist.updateOne( { _id: req.body.payload._id }, updateData );
|
|
400
|
+
conosole.log( response );
|
|
400
401
|
if ( response.modifiedCount || response.matchedCount ) {
|
|
401
402
|
let storeTimeZone = await storeService.findOne( { storeName: checklistDetails.storeName }, { 'storeProfile.timeZone': 1 } );
|
|
402
403
|
let currentDateTime;
|
|
@@ -413,8 +414,8 @@ export async function redoChecklist( req, res ) {
|
|
|
413
414
|
sectionName: question[sectionIndex].sectionName,
|
|
414
415
|
questionName: question[sectionIndex].questions[findQuestion].qname,
|
|
415
416
|
action: 'redo',
|
|
416
|
-
store_id: checklistDetails
|
|
417
|
-
storeName: checklistDetails
|
|
417
|
+
store_id: checklistDetails?.store_id?checklistDetails?.store_id:'',
|
|
418
|
+
storeName: checklistDetails?.storeName?checklistDetails?.storeName:'',
|
|
418
419
|
client_id: checklistDetails.client_id,
|
|
419
420
|
processedChecklistId: checklistDetails._id,
|
|
420
421
|
type: checklistDetails.checkListType,
|
|
@@ -438,7 +439,7 @@ export async function redoChecklist( req, res ) {
|
|
|
438
439
|
};
|
|
439
440
|
let url = JSON.parse( process.env.LAMBDAURL );
|
|
440
441
|
let searchResponse = await fetch( url.redoChecklist, requestOptions );
|
|
441
|
-
|
|
442
|
+
console.log( searchResponse.ok );
|
|
442
443
|
|
|
443
444
|
if ( searchResponse.ok ) {
|
|
444
445
|
return res.sendSuccess( 'Question redo successfully' );
|
|
@@ -20,8 +20,6 @@ import { logger } from 'tango-app-api-middleware';
|
|
|
20
20
|
import mongoose from 'mongoose';
|
|
21
21
|
import { sendPushNotification } from 'tango-app-api-middleware';
|
|
22
22
|
import * as planoService from '../services/planogram.service.js';
|
|
23
|
-
import * as clusterServices from '../services/cluster.service.js';
|
|
24
|
-
import * as teamsServices from '../services/teams.service.js';
|
|
25
23
|
|
|
26
24
|
|
|
27
25
|
const ObjectId = mongoose.Types.ObjectId;
|
|
@@ -343,152 +341,6 @@ async function insertData( requestData ) {
|
|
|
343
341
|
} );
|
|
344
342
|
let allQuestion = await CLassign.aggregate( getquestionQuery );
|
|
345
343
|
if ( allQuestion.length ) {
|
|
346
|
-
let assignList = [];
|
|
347
|
-
if ( getCLconfig.coverage == 'store' ) {
|
|
348
|
-
let clusterList = allQuestion.filter( ( ele ) => ele?.clusterName ).map( ( item ) => item.assignId );
|
|
349
|
-
if ( clusterList.length ) {
|
|
350
|
-
let clusterDetails = await clusterServices.findcluster( { _id: { $in: clusterList } } );
|
|
351
|
-
if ( clusterDetails.length ) {
|
|
352
|
-
let idList = clusterDetails.flatMap( ( item ) => item.stores.map( ( ele ) => ele.store ) );
|
|
353
|
-
let getStoreDetails = await storeService.find( { _id: { $in: idList } } );
|
|
354
|
-
if ( getStoreDetails.length ) {
|
|
355
|
-
assignList = await Promise.all( getStoreDetails.map( async ( store ) => {
|
|
356
|
-
let userDetails = await userService.findOne( { email: store?.spocDetails?.[0]?.email, clientId: store.clientId } );
|
|
357
|
-
if ( !userDetails ) {
|
|
358
|
-
let data = {
|
|
359
|
-
clientId: store.clientId,
|
|
360
|
-
userName: store.spocDetails?.[0]?.name,
|
|
361
|
-
mobileNumber: store.spocDetails?.[0]?.phone || '',
|
|
362
|
-
email: store.spocDetails[0].email,
|
|
363
|
-
password: '5dqFKAJj29PsV6P+kL+3Dw==',
|
|
364
|
-
role: 'user',
|
|
365
|
-
userType: 'client',
|
|
366
|
-
rolespermission: [
|
|
367
|
-
{
|
|
368
|
-
featureName: 'Global',
|
|
369
|
-
modules: [
|
|
370
|
-
{
|
|
371
|
-
name: 'Store',
|
|
372
|
-
isAdd: false,
|
|
373
|
-
isEdit: false,
|
|
374
|
-
|
|
375
|
-
},
|
|
376
|
-
{
|
|
377
|
-
name: 'User',
|
|
378
|
-
isAdd: false,
|
|
379
|
-
isEdit: false,
|
|
380
|
-
|
|
381
|
-
},
|
|
382
|
-
{
|
|
383
|
-
name: 'Camera',
|
|
384
|
-
isAdd: false,
|
|
385
|
-
isEdit: false,
|
|
386
|
-
|
|
387
|
-
},
|
|
388
|
-
{
|
|
389
|
-
name: 'Configuration',
|
|
390
|
-
isAdd: false,
|
|
391
|
-
isEdit: false,
|
|
392
|
-
|
|
393
|
-
},
|
|
394
|
-
{
|
|
395
|
-
name: 'Subscription',
|
|
396
|
-
isAdd: false,
|
|
397
|
-
isEdit: false,
|
|
398
|
-
|
|
399
|
-
},
|
|
400
|
-
{
|
|
401
|
-
name: 'Billing',
|
|
402
|
-
isAdd: false,
|
|
403
|
-
isEdit: false,
|
|
404
|
-
|
|
405
|
-
},
|
|
406
|
-
],
|
|
407
|
-
},
|
|
408
|
-
{
|
|
409
|
-
featurName: 'TangoEye',
|
|
410
|
-
modules: [
|
|
411
|
-
{
|
|
412
|
-
name: 'ZoneTag',
|
|
413
|
-
isAdd: false,
|
|
414
|
-
isEdit: false,
|
|
415
|
-
|
|
416
|
-
},
|
|
417
|
-
],
|
|
418
|
-
},
|
|
419
|
-
{
|
|
420
|
-
featurName: 'TangoTrax',
|
|
421
|
-
modules: [
|
|
422
|
-
{
|
|
423
|
-
name: 'checklist',
|
|
424
|
-
isAdd: false,
|
|
425
|
-
isEdit: false,
|
|
426
|
-
|
|
427
|
-
},
|
|
428
|
-
{
|
|
429
|
-
name: 'Task',
|
|
430
|
-
isAdd: false,
|
|
431
|
-
isEdit: false,
|
|
432
|
-
|
|
433
|
-
},
|
|
434
|
-
],
|
|
435
|
-
},
|
|
436
|
-
],
|
|
437
|
-
};
|
|
438
|
-
userDetails = await userService.create( data );
|
|
439
|
-
}
|
|
440
|
-
let data = {
|
|
441
|
-
store_id: store?.storeId,
|
|
442
|
-
storeName: store?.storeName,
|
|
443
|
-
userId: userDetails._id,
|
|
444
|
-
userName: userDetails.userName,
|
|
445
|
-
userEmail: userDetails.email,
|
|
446
|
-
userPhone: userDetails?.mobileNumber,
|
|
447
|
-
city: store?.storeProfile?.city,
|
|
448
|
-
country: store?.storeProfile?.country,
|
|
449
|
-
checkFlag: true,
|
|
450
|
-
checkListId: getCLconfig._id,
|
|
451
|
-
checkListName: getCLconfig.checkListName,
|
|
452
|
-
client_id: getCLconfig.client_id,
|
|
453
|
-
};
|
|
454
|
-
return data;
|
|
455
|
-
} ) );
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
}
|
|
459
|
-
allQuestion = allQuestion.filter( ( ele ) => !clusterList.includes( ele.assignId ) );
|
|
460
|
-
}
|
|
461
|
-
if ( getCLconfig.coverage == 'user' ) {
|
|
462
|
-
let teamsList = allQuestion.filter( ( ele ) => ele?.teamName ).map( ( item ) => item.assignId );
|
|
463
|
-
if ( teamsList.length ) {
|
|
464
|
-
let teamDetails = await teamsServices.findteams( { _id: { $in: teamsList } } );
|
|
465
|
-
if ( teamDetails.length ) {
|
|
466
|
-
let idList = teamDetails.flatMap( ( item ) => item.users.map( ( ele ) => ele.userId ) );
|
|
467
|
-
let getUserDetails = await userService.find( { _id: { $in: idList } } );
|
|
468
|
-
if ( getUserDetails.length ) {
|
|
469
|
-
assignList = getUserDetails.map( ( user ) => {
|
|
470
|
-
let data = {
|
|
471
|
-
store_id: '',
|
|
472
|
-
storeName: '',
|
|
473
|
-
userId: user._id,
|
|
474
|
-
userName: user.userName,
|
|
475
|
-
userEmail: user.email,
|
|
476
|
-
userPhone: user?.mobileNumber,
|
|
477
|
-
city: '',
|
|
478
|
-
country: '',
|
|
479
|
-
checkFlag: true,
|
|
480
|
-
checkListId: getCLconfig._id,
|
|
481
|
-
checkListName: getCLconfig.checkListName,
|
|
482
|
-
client_id: getCLconfig.client_id,
|
|
483
|
-
};
|
|
484
|
-
return data;
|
|
485
|
-
} );
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
}
|
|
489
|
-
allQuestion = allQuestion.filter( ( ele ) => !teamsList.includes( ele.assignId ) );
|
|
490
|
-
}
|
|
491
|
-
allQuestion = [ ...allQuestion, ...assignList ];
|
|
492
344
|
let userIdList = [];
|
|
493
345
|
for ( let element4 of allQuestion ) {
|
|
494
346
|
if ( getCLconfig.allowOnce && ![ 'onetime', 'daily' ].includes( getCLconfig.schedule ) ) {
|
|
@@ -863,7 +863,7 @@ export const assignedUserDetails = async ( req, res ) => {
|
|
|
863
863
|
let page = parseInt( req.query.offset ) || 0;
|
|
864
864
|
let skip = limit * page;
|
|
865
865
|
|
|
866
|
-
let query = [ { $match: { checkListId: new ObjectId( req.params.checklistId ),
|
|
866
|
+
let query = [ { $match: { checkListId: new ObjectId( req.params.checklistId ), isdeleted: false } } ];
|
|
867
867
|
if ( req.query.search.trim() && req.query.search.trim() != '' ) {
|
|
868
868
|
let searchValue = req.query.search;
|
|
869
869
|
searchValue = searchValue.split( ',' ).map( ( item ) => item.trim().toLowerCase() );
|
|
@@ -972,7 +972,7 @@ export const assignedUserDetailsv1 = async ( req, res ) => {
|
|
|
972
972
|
// let page = parseInt( req.query.offset ) || 0;
|
|
973
973
|
// let skip = limit * page;
|
|
974
974
|
|
|
975
|
-
let query = [ { $match: { checkListId: new ObjectId( req.params.checklistId ),
|
|
975
|
+
let query = [ { $match: { checkListId: new ObjectId( req.params.checklistId ), isdeleted: false } } ];
|
|
976
976
|
if ( req.query.search.trim() && req.query.search.trim() != '' ) {
|
|
977
977
|
let searchValue = req.query.search;
|
|
978
978
|
searchValue = searchValue.split( ',' ).map( ( item ) => item.trim().toLowerCase() );
|
|
@@ -3638,7 +3638,7 @@ async function assignUsers( data ) {
|
|
|
3638
3638
|
];
|
|
3639
3639
|
let storeDetails = await storeService.aggregate( query );
|
|
3640
3640
|
if ( storeDetails.length ) {
|
|
3641
|
-
let email = data?.upload ? data.userEmail : storeDetails?.[0]?.spocDetails?.
|
|
3641
|
+
let email = data?.upload ? data.userEmail : storeDetails?.[0]?.spocDetails?.email;
|
|
3642
3642
|
let userDetails = await userService.findOne( { email: email, clientId: data.clientId } );
|
|
3643
3643
|
if ( !userDetails ) {
|
|
3644
3644
|
let userData = {
|
|
@@ -3764,7 +3764,7 @@ export async function checklistAssign( req, res ) {
|
|
|
3764
3764
|
return res.sendError( 'No data found', 204 );
|
|
3765
3765
|
}
|
|
3766
3766
|
assignList = await Promise.all( getStoreDetails.map( async ( store ) => {
|
|
3767
|
-
let userDetails = await userService.findOne( { email: store?.spocDetails?.
|
|
3767
|
+
let userDetails = await userService.findOne( { email: store?.spocDetails?.email, clientId: store.clientId } );
|
|
3768
3768
|
if ( !userDetails ) {
|
|
3769
3769
|
let data = {
|
|
3770
3770
|
clientId: store.clientId,
|