tango-app-api-task 3.2.1-beta-30 → 3.2.1-beta-32
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 +1 -1
- package/src/controllers/task.controller.js +359 -345
- package/src/routes/task.routes.js +4 -3
package/package.json
CHANGED
|
@@ -264,9 +264,29 @@ export async function taskDetails( req, res ) {
|
|
|
264
264
|
}
|
|
265
265
|
if ( storechecklistdetails ) {
|
|
266
266
|
result.checkListDetails = { ...storechecklistdetails._doc };
|
|
267
|
-
let
|
|
268
|
-
|
|
269
|
-
|
|
267
|
+
let query = {
|
|
268
|
+
checkListId: storechecklistdetails._id,
|
|
269
|
+
...( storechecklistdetails.coverage == 'store' ) ? { $or: [ { store_id: { $exists: true } }, { clusterName: { $exists: true } } ] } : { $or: [ { userEmail: { $exists: true } }, { teamName: { $exists: true } } ] },
|
|
270
|
+
};
|
|
271
|
+
let assignList = await taskAssignService.find( query, { _id: 1, store_id: 1, clusterName: 1, userEmail: 1, teamName: 1, assignId: 1 } );
|
|
272
|
+
let singleAssign;
|
|
273
|
+
let groupAssign;
|
|
274
|
+
if ( storechecklistdetails.coverage == 'store' ) {
|
|
275
|
+
singleAssign = assignList.filter( ( item ) => typeof item?.store_id != 'undefined' && item?.store_id != '' ).map( ( item ) => {
|
|
276
|
+
return { id: item.assignId, type: 'store' };
|
|
277
|
+
} );
|
|
278
|
+
groupAssign = assignList.filter( ( item ) => typeof item?.clusterName != 'undefined' && item?.clusterName != '' ).map( ( item ) => {
|
|
279
|
+
return { id: item.assignId, type: 'cluster' };
|
|
280
|
+
} );
|
|
281
|
+
} else {
|
|
282
|
+
singleAssign = assignList.filter( ( item ) => typeof item?.userEmail != 'undefined' && item?.userEmail !='' ).map( ( item ) => {
|
|
283
|
+
return { id: item.assignId, type: 'user' };
|
|
284
|
+
} );
|
|
285
|
+
groupAssign = assignList.filter( ( item ) => typeof item?.teamName != 'undefined' && item?.teamName != '' ).map( ( item ) => {
|
|
286
|
+
return { id: item.assignId, type: 'teams' };
|
|
287
|
+
} );
|
|
288
|
+
}
|
|
289
|
+
result.checkListDetails = { ...result.checkListDetails, ...{ sections: sectionList }, singleAssign, groupAssign };
|
|
270
290
|
}
|
|
271
291
|
return res.sendSuccess( result );
|
|
272
292
|
} catch ( e ) {
|
|
@@ -435,6 +455,179 @@ export async function validateUser( req, res ) {
|
|
|
435
455
|
}
|
|
436
456
|
};
|
|
437
457
|
|
|
458
|
+
export const validateUserv1 = async ( req, res ) => {
|
|
459
|
+
try {
|
|
460
|
+
if ( !req.body.assignedUsers.length ) {
|
|
461
|
+
return res.sendError( 'Please Enter user Details', 400 );
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
let assignDetails = req.body.assignedUsers;
|
|
465
|
+
|
|
466
|
+
if ( req.body.coverage == 'store' ) {
|
|
467
|
+
const duplicateStore = assignDetails.reduce( ( acc, obj ) => {
|
|
468
|
+
if ( !acc[obj.storeName.toLowerCase()] ) {
|
|
469
|
+
acc[obj.storeName.toLowerCase()] = {
|
|
470
|
+
email: [ obj.userEmail.toLowerCase() ],
|
|
471
|
+
count: 1,
|
|
472
|
+
};
|
|
473
|
+
} else {
|
|
474
|
+
if ( acc[obj.storeName.toLowerCase()] ) {
|
|
475
|
+
if ( acc[obj.storeName.toLowerCase()].email.includes( obj.userEmail.toLowerCase() ) ) {
|
|
476
|
+
acc[obj.storeName.toLowerCase()].count++;
|
|
477
|
+
} else {
|
|
478
|
+
acc[obj.storeName.toLowerCase()].email.push( obj.userEmail.toLowerCase() );
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
return acc;
|
|
483
|
+
}, {} );
|
|
484
|
+
|
|
485
|
+
const duplicateStores = Object.keys( duplicateStore ).filter( ( storeName ) => duplicateStore[storeName].count > 1 );
|
|
486
|
+
if ( duplicateStores.length ) {
|
|
487
|
+
return res.sendSuccess( { validate: false, ExistsEmail: duplicateStores, message: 'Store and email is duplicated' } );
|
|
488
|
+
}
|
|
489
|
+
} else {
|
|
490
|
+
const duplicateUser = assignDetails.reduce( ( acc, obj ) => {
|
|
491
|
+
if ( !acc[obj.userEmail.toLowerCase()] ) {
|
|
492
|
+
acc[obj.userEmail.toLowerCase()] = {
|
|
493
|
+
name: [ obj.userName.toLowerCase() ],
|
|
494
|
+
count: 1,
|
|
495
|
+
};
|
|
496
|
+
} else {
|
|
497
|
+
if ( acc[obj.userEmail.toLowerCase()] ) {
|
|
498
|
+
if ( acc[obj.userEmail.toLowerCase()].name.includes( obj.userName.toLowerCase() ) ) {
|
|
499
|
+
acc[obj.userEmail.toLowerCase()].count++;
|
|
500
|
+
} else {
|
|
501
|
+
acc[obj.userEmail.toLowerCase()].name.push( obj.userEmail.toLowerCase() );
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
return acc;
|
|
506
|
+
}, {} );
|
|
507
|
+
|
|
508
|
+
const duplicateUsers = Object.keys( duplicateUser ).filter( ( storeName ) => duplicateUser[storeName].count > 1 );
|
|
509
|
+
if ( duplicateUsers.length ) {
|
|
510
|
+
return res.sendSuccess( { validate: false, ExistsEmail: duplicateUsers, message: 'Email is Duplicated' } );
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
if ( req.body.hasOwnProperty( 'addSingle' ) ) {
|
|
515
|
+
let checkExists = await taskAssignService.findOne( { userEmail: assignDetails[0]?.userEmail, storeName: assignDetails[0]?.storeName, checkListId: req.body.id } );
|
|
516
|
+
if ( checkExists ) {
|
|
517
|
+
return res.sendError( 'User already Exists', 400 );
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
let userEmailList = assignDetails.map( ( item ) => item.userEmail.toLowerCase() );
|
|
522
|
+
let storeList = assignDetails.map( ( item ) => item?.storeName?.toLowerCase() );
|
|
523
|
+
|
|
524
|
+
let userQuery = [
|
|
525
|
+
{
|
|
526
|
+
$project: {
|
|
527
|
+
newEmail: { $toLower: '$email' },
|
|
528
|
+
isActive: 1,
|
|
529
|
+
clientId: 1,
|
|
530
|
+
},
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
$match: {
|
|
534
|
+
newEmail: { $in: userEmailList },
|
|
535
|
+
isActive: true,
|
|
536
|
+
clientId: req.body.clientId,
|
|
537
|
+
},
|
|
538
|
+
},
|
|
539
|
+
];
|
|
540
|
+
|
|
541
|
+
let emailCheckQuery = [
|
|
542
|
+
{
|
|
543
|
+
$project: {
|
|
544
|
+
newEmail: { $toLower: '$email' },
|
|
545
|
+
isActive: 1,
|
|
546
|
+
clientId: 1,
|
|
547
|
+
},
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
$match: {
|
|
551
|
+
newEmail: { $in: userEmailList },
|
|
552
|
+
isActive: true,
|
|
553
|
+
clientId: { $ne: req.body.clientId },
|
|
554
|
+
},
|
|
555
|
+
},
|
|
556
|
+
];
|
|
557
|
+
|
|
558
|
+
let storeQuery = [
|
|
559
|
+
{
|
|
560
|
+
$project: {
|
|
561
|
+
'storeName': { $toLower: '$storeName' },
|
|
562
|
+
'clientId': 1,
|
|
563
|
+
'storeProfile.city': 1,
|
|
564
|
+
'status': 1,
|
|
565
|
+
'storeId': 1,
|
|
566
|
+
},
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
$match: {
|
|
570
|
+
clientId: req.body.clientId,
|
|
571
|
+
storeName: { $in: storeList },
|
|
572
|
+
},
|
|
573
|
+
},
|
|
574
|
+
];
|
|
575
|
+
|
|
576
|
+
let [ userDetails, storeDetails, existEmail ] = await Promise.all( [
|
|
577
|
+
await userService.aggregate( userQuery ),
|
|
578
|
+
await storeService.aggregate( storeQuery ),
|
|
579
|
+
await userService.aggregate( emailCheckQuery ),
|
|
580
|
+
] );
|
|
581
|
+
|
|
582
|
+
existEmail = existEmail.map( ( ele ) => ele.newEmail );
|
|
583
|
+
let existUserEmail = userDetails.map( ( ele ) => ele.newEmail );
|
|
584
|
+
let newUserList = userEmailList.filter( ( ele ) => !existUserEmail.includes( ele ) && !existEmail.includes( ele ) );
|
|
585
|
+
let inActiveStores = storeDetails.filter( ( ele ) => ele.status == 'deactive' ).map( ( ele ) => ele.storeName );
|
|
586
|
+
|
|
587
|
+
let existsStore = storeDetails.map( ( ele ) => ele?.storeName );
|
|
588
|
+
let newStoreList = storeList.filter( ( ele ) => ele != null && !existsStore.includes( ele.toLowerCase() ) );
|
|
589
|
+
if ( req.body.coverage == 'store' ) {
|
|
590
|
+
assignDetails.forEach( ( item ) => {
|
|
591
|
+
let getStoreId = storeDetails.find( ( store ) => store.storeName.toLowerCase() == item.storeName.toLowerCase() );
|
|
592
|
+
if ( getStoreId ) {
|
|
593
|
+
item._id = getStoreId._id;
|
|
594
|
+
item.storeId = getStoreId.storeId;
|
|
595
|
+
}
|
|
596
|
+
} );
|
|
597
|
+
} else {
|
|
598
|
+
assignDetails.forEach( ( item ) => {
|
|
599
|
+
let getUserId = userDetails.find( ( user ) => user.newEmail.toLowerCase() == item.userEmail.toLowerCase() );
|
|
600
|
+
if ( getUserId ) {
|
|
601
|
+
item._id = getUserId._id;
|
|
602
|
+
}
|
|
603
|
+
} );
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
if ( ( newUserList.length || newStoreList.length || existEmail.length || inActiveStores.length ) && !req.body?.addUser ) {
|
|
607
|
+
return res.sendError( { validate: false, user: newUserList, store: newStoreList, existEmail, inActiveStores, data: assignDetails }, 400 );
|
|
608
|
+
}
|
|
609
|
+
if ( req.body.coverage == 'user' ) {
|
|
610
|
+
await Promise.all( newUserList.map( async ( ele ) => {
|
|
611
|
+
let findUserIndex = assignDetails.findIndex( ( item ) => item?.userEmail?.toLowerCase() == ele?.toLowerCase() );
|
|
612
|
+
if ( findUserIndex != -1 ) {
|
|
613
|
+
let data = {
|
|
614
|
+
userName: assignDetails[findUserIndex]?.userName,
|
|
615
|
+
email: ele,
|
|
616
|
+
mobileNumber: assignDetails[findUserIndex]?.mobileNumber,
|
|
617
|
+
clientId: req.body.clientId,
|
|
618
|
+
};
|
|
619
|
+
let response = await createUser( data );
|
|
620
|
+
assignDetails[findUserIndex]._id = response._id;
|
|
621
|
+
}
|
|
622
|
+
} ) );
|
|
623
|
+
}
|
|
624
|
+
return res.sendSuccess( { validate: true, data: assignDetails } );
|
|
625
|
+
} catch ( e ) {
|
|
626
|
+
logger.error( 'validateUser 2=>', e );
|
|
627
|
+
return res.sendError( e, 500 );
|
|
628
|
+
}
|
|
629
|
+
};
|
|
630
|
+
|
|
438
631
|
async function uploadUser( req, res ) {
|
|
439
632
|
try {
|
|
440
633
|
let inputBody = req.body;
|
|
@@ -565,45 +758,29 @@ export async function userDetails( req, res ) {
|
|
|
565
758
|
if ( !req.query.taskId ) {
|
|
566
759
|
return res.sendError( { message: 'Task Id is required' }, 400 );
|
|
567
760
|
}
|
|
761
|
+
// let limit = parseInt( req.query.limit ) || 5;
|
|
762
|
+
// let page = parseInt( req.query.offset ) || 0;
|
|
763
|
+
// let skip = limit * page;
|
|
568
764
|
|
|
569
|
-
let query = [ { $match: { checkListId: new ObjectId( req.query.taskId ),
|
|
570
|
-
if ( req.query?.search?.trim() && req.query?.search?.trim() != '' ) {
|
|
571
|
-
let searchValue = req.query.search;
|
|
572
|
-
searchValue = searchValue.split( ',' ).map( ( item ) => item.trim().toLowerCase() );
|
|
573
|
-
if ( searchValue.length > 1 ) {
|
|
574
|
-
query.push( { $addFields: { storeLower: { $toLower: '$storeName' } } } );
|
|
575
|
-
query.push( { $match: { storeLower: { $in: searchValue } } } );
|
|
576
|
-
} else {
|
|
577
|
-
query.push( { $match: { storeName: { $regex: req.query.search.trim(), $options: 'i' } } } );
|
|
578
|
-
}
|
|
579
|
-
}
|
|
765
|
+
let query = [ { $match: { checkListId: new ObjectId( req.query.taskId ), isdeleted: false } }, { $sort: { _id: -1 } } ];
|
|
580
766
|
|
|
581
767
|
let taskDetails = await taskAssignService.aggregate( query );
|
|
582
|
-
|
|
583
|
-
if ( !taskDetails[0].data.length ) {
|
|
768
|
+
if ( !taskDetails.length ) {
|
|
584
769
|
return res.sendError( 'No data found', 204 );
|
|
585
770
|
}
|
|
586
771
|
|
|
587
772
|
let userDetails = [];
|
|
588
|
-
let storeList = [];
|
|
589
|
-
let userList = [];
|
|
590
773
|
await Promise.all( taskDetails.map( async ( ele ) => {
|
|
591
|
-
if ( ele?.store_id || ele?.clusterName ) {
|
|
592
|
-
storeList.push( ele.assignId );
|
|
593
|
-
} else {
|
|
594
|
-
userList.push( ele.assignId );
|
|
595
|
-
}
|
|
596
|
-
|
|
597
774
|
if ( ele?.clusterName ) {
|
|
598
775
|
let clusterDetails = await clusterServices.findOneCluster( { _id: ele.assignId }, { stores: 1 } );
|
|
599
776
|
if ( clusterDetails ) {
|
|
600
777
|
let storeDetails = await storeService.find( { _id: { $in: clusterDetails.stores.map( ( item ) => item.store ) }, status: 'active' } );
|
|
601
778
|
storeDetails.forEach( ( item ) => {
|
|
602
779
|
userDetails.push( {
|
|
603
|
-
|
|
780
|
+
_id: ele.assignId,
|
|
604
781
|
userName: item.spocDetails?.[0]?.name,
|
|
605
782
|
userEmail: item.spocDetails?.[0]?.email,
|
|
606
|
-
|
|
783
|
+
storeId: item?.storeId,
|
|
607
784
|
storeName: item?.storeName,
|
|
608
785
|
userPhone: item.spocDetails?.[0]?.phone,
|
|
609
786
|
city: ele?.city,
|
|
@@ -619,10 +796,10 @@ export async function userDetails( req, res ) {
|
|
|
619
796
|
let teamUserDetails = await userService.find( { _id: { $in: teamDetails.users.map( ( item ) => item.userId ) } } );
|
|
620
797
|
teamUserDetails.forEach( ( item ) => {
|
|
621
798
|
userDetails.push( {
|
|
622
|
-
|
|
799
|
+
_id: ele.assignId,
|
|
623
800
|
userName: item.userName,
|
|
624
801
|
userEmail: item.email,
|
|
625
|
-
|
|
802
|
+
storeId: ele?.storeId,
|
|
626
803
|
storeName: ele?.storeName,
|
|
627
804
|
userPhone: item?.mobileNumber,
|
|
628
805
|
city: ele?.city,
|
|
@@ -634,10 +811,10 @@ export async function userDetails( req, res ) {
|
|
|
634
811
|
}
|
|
635
812
|
} else {
|
|
636
813
|
userDetails.push( {
|
|
637
|
-
|
|
814
|
+
_id: ele.assignId,
|
|
638
815
|
userName: ele.userName,
|
|
639
816
|
userEmail: ele.userEmail,
|
|
640
|
-
|
|
817
|
+
storeId: ele?.store_id,
|
|
641
818
|
storeName: ele?.storeName,
|
|
642
819
|
userPhone: ele.userPhone,
|
|
643
820
|
city: ele.city,
|
|
@@ -648,9 +825,9 @@ export async function userDetails( req, res ) {
|
|
|
648
825
|
}
|
|
649
826
|
} ) );
|
|
650
827
|
|
|
651
|
-
return res.sendSuccess( { count: userDetails.length,
|
|
828
|
+
return res.sendSuccess( { count: userDetails.length, userDetails } );
|
|
652
829
|
} catch ( e ) {
|
|
653
|
-
logger.error(
|
|
830
|
+
logger.error( 'userDetails =>', e );
|
|
654
831
|
return res.sendError( e, 500 );
|
|
655
832
|
}
|
|
656
833
|
};
|
|
@@ -729,20 +906,6 @@ export async function taskConfig( req, res ) {
|
|
|
729
906
|
await traxApprover.insertMany( data );
|
|
730
907
|
}
|
|
731
908
|
}
|
|
732
|
-
if ( inputBody.assignedUsers.length ) {
|
|
733
|
-
await taskAssignService.deleteMany( { checkListId: inputBody._id } );
|
|
734
|
-
await Promise.all( inputBody.assignedUsers.map( async ( user ) => {
|
|
735
|
-
let data = {
|
|
736
|
-
...user,
|
|
737
|
-
clientId: req.body.clientId,
|
|
738
|
-
checkListName: checklistDetails.checkListName,
|
|
739
|
-
checklistId: checklistDetails._id,
|
|
740
|
-
coverage: inputBody.coverage,
|
|
741
|
-
insert: true,
|
|
742
|
-
};
|
|
743
|
-
await assignUsers( data );
|
|
744
|
-
} ) );
|
|
745
|
-
}
|
|
746
909
|
let storeConfigDetails = await taskAssignService.find( { checkListId: inputBody._id, checkFlag: true }, { _id: 0, store_id: 1, userEmail: 1, storeName: 1 } );
|
|
747
910
|
if ( inputBody.submitType == 'publish' ) {
|
|
748
911
|
let taskName = checklistDetails.checkListName;
|
|
@@ -916,6 +1079,10 @@ export async function insertSingleProcessData( checklistId ) {
|
|
|
916
1079
|
|
|
917
1080
|
async function insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, date, startTimeIso, endTimeIso, insertdata ) {
|
|
918
1081
|
let getquestionQuery = [];
|
|
1082
|
+
if ( dayjs( getCLconfig.publishDate ).format( 'YYYY-MM-DD' ) != dayjs( date ).format( 'YYYY-MM-DD' ) ) {
|
|
1083
|
+
let todayDate = `${dayjs( date ).format( 'YYYY-MM-DD' )} 00:00 AM`;
|
|
1084
|
+
startTimeIso = dayjs( todayDate, 'YYYY-MM-DD HH:mm A' );
|
|
1085
|
+
}
|
|
919
1086
|
getquestionQuery.push( {
|
|
920
1087
|
$match: {
|
|
921
1088
|
checkListId: new ObjectId( checklistId ),
|
|
@@ -3341,6 +3508,68 @@ export async function uploadmultiImage( images ) {
|
|
|
3341
3508
|
}
|
|
3342
3509
|
};
|
|
3343
3510
|
|
|
3511
|
+
async function assignUsers( data ) {
|
|
3512
|
+
let assignedData;
|
|
3513
|
+
if ( data?.type == 'cluster' ) {
|
|
3514
|
+
let clusterDetails = await clusterServices.findcluster( { clientId: data.clientId, _id: new mongoose.Types.ObjectId( data.id ) } );
|
|
3515
|
+
if ( clusterDetails.length ) {
|
|
3516
|
+
let clusterList = clusterDetails[0].stores.map( ( ele ) => ele.store );
|
|
3517
|
+
let storeDetails = await storeService.find( { _id: { $in: clusterList }, status: 'active' } );
|
|
3518
|
+
assignedData = await Promise.all( storeDetails.map( async ( store ) => {
|
|
3519
|
+
let userData = {
|
|
3520
|
+
storeId: store.storeId,
|
|
3521
|
+
storeName: store.storeName,
|
|
3522
|
+
userName: store.spocDetails?.[0]?.name,
|
|
3523
|
+
userEmail: store.spocDetails?.[0]?.email,
|
|
3524
|
+
clusterName: clusterDetails?.[0]?.clusterName,
|
|
3525
|
+
id: clusterDetails?.[0]?._id,
|
|
3526
|
+
};
|
|
3527
|
+
return userData;
|
|
3528
|
+
} ) );
|
|
3529
|
+
}
|
|
3530
|
+
} else {
|
|
3531
|
+
let teamDetails = await teamsServices.findteams( { clientId: data.clientId, _id: new mongoose.Types.ObjectId( data.id ) } );
|
|
3532
|
+
if ( teamDetails.length ) {
|
|
3533
|
+
let userIdList = teamDetails[0].users.map( ( ele ) => ele.userId );
|
|
3534
|
+
let userDetails = await userService.find( { _id: userIdList } );
|
|
3535
|
+
assignedData = userDetails.map( ( user ) => {
|
|
3536
|
+
let userData = {
|
|
3537
|
+
userName: user.userName,
|
|
3538
|
+
userEmail: user.email,
|
|
3539
|
+
teamName: teamDetails?.[0]?.teamName,
|
|
3540
|
+
id: teamDetails?.[0]?._id,
|
|
3541
|
+
};
|
|
3542
|
+
return userData;
|
|
3543
|
+
} );
|
|
3544
|
+
}
|
|
3545
|
+
}
|
|
3546
|
+
return assignedData;
|
|
3547
|
+
}
|
|
3548
|
+
|
|
3549
|
+
export async function customertrial( params ) {
|
|
3550
|
+
try {
|
|
3551
|
+
// let inputData = {
|
|
3552
|
+
// Bucket: 'tango-trax-audit',
|
|
3553
|
+
// file_path: 'trail/59-147/b1c5b15c0133dec0c45640d923fda221_10_09_59_000_24_01_2025_false.mp4',
|
|
3554
|
+
// };
|
|
3555
|
+
// let url = await signedUrl( inputData );
|
|
3556
|
+
// console.log( url );
|
|
3557
|
+
|
|
3558
|
+
|
|
3559
|
+
let inputData = {
|
|
3560
|
+
Bucket: 'tango-trax-audit',
|
|
3561
|
+
Key: 'hygiene/16-01-2025/11-2212/11-2212_13d76f2dd3ea3123aa476a885893c9fd_labelled.jpeg',
|
|
3562
|
+
};
|
|
3563
|
+
|
|
3564
|
+
|
|
3565
|
+
let url = await getObject( inputData );
|
|
3566
|
+
console.log( url );
|
|
3567
|
+
} catch ( e ) {
|
|
3568
|
+
logger.error( 'uploadImage =>', e );
|
|
3569
|
+
return e;
|
|
3570
|
+
}
|
|
3571
|
+
};
|
|
3572
|
+
|
|
3344
3573
|
export async function taskAssign( req, res ) {
|
|
3345
3574
|
try {
|
|
3346
3575
|
if ( !req.body.taskId ) {
|
|
@@ -3357,343 +3586,128 @@ export async function taskAssign( req, res ) {
|
|
|
3357
3586
|
if ( !taskDetails ) {
|
|
3358
3587
|
return res.sendError( 'No data found', 204 );
|
|
3359
3588
|
}
|
|
3360
|
-
let assignList = [];
|
|
3361
3589
|
|
|
3362
|
-
|
|
3363
|
-
// let assignedData = {
|
|
3364
|
-
// ...data,
|
|
3365
|
-
// clientId: req.body.clientId,
|
|
3366
|
-
// checkListName: taskDetails.checkListName,
|
|
3367
|
-
// checklistId: taskDetails._id,
|
|
3368
|
-
// coverage: req.body.coverage,
|
|
3369
|
-
// insert: false,
|
|
3370
|
-
// };
|
|
3371
|
-
// // console.log( assignedData, 'daterthj' );
|
|
3372
|
-
// let uploadData = await assignUsers( assignedData );
|
|
3373
|
-
// if ( uploadData ) {
|
|
3374
|
-
// if ( Array.isArray( uploadData ) ) {
|
|
3375
|
-
// assignList.push( ...uploadData );
|
|
3376
|
-
// } else {
|
|
3377
|
-
// assignList.push( uploadData );
|
|
3378
|
-
// }
|
|
3379
|
-
// }
|
|
3380
|
-
// }
|
|
3590
|
+
let uniqueArr = [];
|
|
3381
3591
|
|
|
3382
3592
|
await Promise.all( req.body.idList.map( async ( data ) => {
|
|
3383
3593
|
let assignedData = {
|
|
3384
3594
|
...data,
|
|
3385
3595
|
clientId: req.body.clientId,
|
|
3386
|
-
checkListName: taskDetails.checkListName,
|
|
3387
|
-
checklistId: taskDetails._id,
|
|
3388
|
-
coverage: req.body.coverage,
|
|
3389
|
-
insert: false,
|
|
3390
3596
|
};
|
|
3391
|
-
// console.log( assignedData, 'daterthj' );
|
|
3392
3597
|
let uploadData = await assignUsers( assignedData );
|
|
3393
|
-
if ( uploadData ) {
|
|
3394
|
-
|
|
3395
|
-
assignList.push( ...uploadData );
|
|
3396
|
-
} else {
|
|
3397
|
-
assignList.push( uploadData );
|
|
3398
|
-
}
|
|
3598
|
+
if ( uploadData.length ) {
|
|
3599
|
+
uniqueArr.push( ...uploadData );
|
|
3399
3600
|
}
|
|
3400
3601
|
} ) );
|
|
3401
3602
|
|
|
3603
|
+
if ( uniqueArr.length ) {
|
|
3604
|
+
if ( req.body.coverage == 'store' ) {
|
|
3605
|
+
uniqueArr = uniqueArr.reduce( ( acc, obj ) => {
|
|
3606
|
+
if ( acc[obj.storeName] ) {
|
|
3607
|
+
acc[obj.storeName].clusterName += ',' + obj.clusterName;
|
|
3608
|
+
} else {
|
|
3609
|
+
acc[obj.storeName] = { ...obj };
|
|
3610
|
+
}
|
|
3611
|
+
return acc;
|
|
3612
|
+
}, {} );
|
|
3613
|
+
|
|
3614
|
+
uniqueArr= Object.values( uniqueArr );
|
|
3615
|
+
} else {
|
|
3616
|
+
uniqueArr = uniqueArr.reduce( ( acc, obj ) => {
|
|
3617
|
+
if ( acc[obj.userEmail] ) {
|
|
3618
|
+
acc[obj.userEmail].teamName += ','+ obj.teamName;
|
|
3619
|
+
} else {
|
|
3620
|
+
acc[obj.userEmail] = { ...obj };
|
|
3621
|
+
}
|
|
3622
|
+
return acc;
|
|
3623
|
+
}, {} );
|
|
3624
|
+
uniqueArr = Object.values( uniqueArr );
|
|
3625
|
+
}
|
|
3626
|
+
}
|
|
3402
3627
|
|
|
3403
|
-
return res.sendSuccess( { count:
|
|
3628
|
+
return res.sendSuccess( { count: uniqueArr.length, uniqueArr } );
|
|
3404
3629
|
} catch ( e ) {
|
|
3405
|
-
logger.error( { functionName: '
|
|
3630
|
+
logger.error( { functionName: 'taskAssign', error: e } );
|
|
3406
3631
|
return res.sendError( e, 500 );
|
|
3407
3632
|
}
|
|
3408
3633
|
}
|
|
3409
3634
|
|
|
3410
|
-
async function
|
|
3411
|
-
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
if ( data?.type == 'cluster' ) {
|
|
3415
|
-
let query = [
|
|
3416
|
-
{
|
|
3417
|
-
$addFields: {
|
|
3418
|
-
cluster: { $toLower: '$clusterName' },
|
|
3419
|
-
},
|
|
3420
|
-
},
|
|
3421
|
-
{
|
|
3422
|
-
$match: {
|
|
3423
|
-
clientId: data.clientId,
|
|
3424
|
-
...( data?.id ) ? { _id: new mongoose.Types.ObjectId( data.id ) } : { cluster: data.clusterName.toLowerCase() },
|
|
3425
|
-
},
|
|
3426
|
-
},
|
|
3427
|
-
{
|
|
3428
|
-
$project: {
|
|
3429
|
-
stores: 1,
|
|
3430
|
-
clusterName: 1,
|
|
3431
|
-
},
|
|
3432
|
-
},
|
|
3433
|
-
];
|
|
3434
|
-
let clusterDetails = await clusterServices.aggregateCluster( query );
|
|
3435
|
-
if ( clusterDetails.length ) {
|
|
3436
|
-
if ( data.insert ) {
|
|
3437
|
-
assignedData = {
|
|
3438
|
-
checkFlag: true,
|
|
3439
|
-
checkListId: data.checklistId,
|
|
3440
|
-
checkListName: data.checkListName,
|
|
3441
|
-
client_id: data?.clientId,
|
|
3442
|
-
clusterName: clusterDetails?.[0]?.clusterName,
|
|
3443
|
-
assignId: data?.id || clusterDetails?.[0]?._id,
|
|
3444
|
-
coverage: 'store',
|
|
3445
|
-
};
|
|
3446
|
-
} else {
|
|
3447
|
-
let clusterList = clusterDetails[0].stores.map( ( ele ) => ele.store );
|
|
3448
|
-
let storeDetails = await storeService.find( { _id: { $in: clusterList }, status: 'active' } );
|
|
3449
|
-
assignedData = await Promise.all( storeDetails.map( async ( store ) => {
|
|
3450
|
-
let userDetails = await userService.findOne( { email: store.spocDetails?.[0]?.email, clientId: data.clientId } );
|
|
3451
|
-
if ( !userDetails && store?.spocDetails?.length ) {
|
|
3452
|
-
let userData = {
|
|
3453
|
-
userName: store.spocDetails?.[0]?.name,
|
|
3454
|
-
email: store.spocDetails[0]?.email,
|
|
3455
|
-
mobileNumber: store.spocDetails?.[0]?.phone,
|
|
3456
|
-
clientId: data.clientId,
|
|
3457
|
-
};
|
|
3458
|
-
userDetails = await createUser( userData );
|
|
3459
|
-
}
|
|
3460
|
-
let userData = {
|
|
3461
|
-
userId: userDetails?._id,
|
|
3462
|
-
userName: userDetails?.userName,
|
|
3463
|
-
userEmail: userDetails?.email,
|
|
3464
|
-
userPhone: userDetails?.mobileNumber,
|
|
3465
|
-
checkFlag: true,
|
|
3466
|
-
checkListId: data.checklistId,
|
|
3467
|
-
checkListName: data.checkListName,
|
|
3468
|
-
client_id: data.clientId,
|
|
3469
|
-
assignId: data?.id || clusterDetails?.[0]?._id,
|
|
3470
|
-
coverage: 'store',
|
|
3471
|
-
clusterName: clusterDetails?.[0]?.clusterName,
|
|
3472
|
-
storeId: store.storeId,
|
|
3473
|
-
storeName: store.storeName,
|
|
3474
|
-
};
|
|
3475
|
-
return userData;
|
|
3476
|
-
} ) );
|
|
3477
|
-
}
|
|
3478
|
-
}
|
|
3479
|
-
} else {
|
|
3480
|
-
let query = [
|
|
3481
|
-
{
|
|
3482
|
-
$addFields: {
|
|
3483
|
-
store: { $toLower: '$storeName' },
|
|
3484
|
-
},
|
|
3485
|
-
},
|
|
3486
|
-
{
|
|
3487
|
-
$match: {
|
|
3488
|
-
clientId: data.clientId,
|
|
3489
|
-
...( data?.id ) ? { _id: new mongoose.Types.ObjectId( data.id ) } : { store: data.storeName.toLowerCase() },
|
|
3490
|
-
},
|
|
3491
|
-
},
|
|
3492
|
-
];
|
|
3493
|
-
let storeDetails = await storeService.aggregate( query );
|
|
3494
|
-
if ( storeDetails.length ) {
|
|
3495
|
-
let email = data?.userEmail ? data.userEmail : storeDetails?.[0]?.spocDetails?.[0]?.email;
|
|
3496
|
-
let userDetails = await userService.findOne( { email: email, clientId: data.clientId } );
|
|
3497
|
-
if ( !userDetails ) {
|
|
3498
|
-
let userData = {
|
|
3499
|
-
userName: storeDetails?.[0]?.spocDetails?.[0]?.name,
|
|
3500
|
-
email: storeDetails?.[0]?.spocDetails[0].email,
|
|
3501
|
-
mobileNumber: storeDetails?.[0]?.spocDetails?.[0]?.phone,
|
|
3502
|
-
clientId: data.clientId,
|
|
3503
|
-
};
|
|
3504
|
-
userDetails = await createUser( userData );
|
|
3505
|
-
console.log( 'userDetails =>', userDetails );
|
|
3506
|
-
}
|
|
3507
|
-
assignedData = {
|
|
3508
|
-
store_id: storeDetails?.[0]?.storeId,
|
|
3509
|
-
storeName: storeDetails?.[0]?.storeName,
|
|
3510
|
-
userId: userDetails._id,
|
|
3511
|
-
userName: userDetails.userName,
|
|
3512
|
-
userEmail: userDetails.email,
|
|
3513
|
-
userPhone: userDetails?.mobileNumber,
|
|
3514
|
-
city: storeDetails?.[0]?.storeProfile?.city,
|
|
3515
|
-
country: storeDetails?.[0]?.storeProfile?.country,
|
|
3516
|
-
checkFlag: true,
|
|
3517
|
-
checkListId: data.checklistId,
|
|
3518
|
-
checkListName: data.checkListName,
|
|
3519
|
-
client_id: data.clientId,
|
|
3520
|
-
assignId: data?.id || storeDetails?.[0]?._id,
|
|
3521
|
-
coverage: 'store',
|
|
3522
|
-
};
|
|
3523
|
-
}
|
|
3635
|
+
export async function updateAssign( req, res ) {
|
|
3636
|
+
try {
|
|
3637
|
+
if ( !req.body.assignedList.length && !req.body.assignedGroup.length ) {
|
|
3638
|
+
return res.sendError( 'No data found', 204 );
|
|
3524
3639
|
}
|
|
3525
|
-
|
|
3526
|
-
if (
|
|
3527
|
-
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
3534
|
-
|
|
3535
|
-
|
|
3536
|
-
...( data?.id ) ? { _id: new mongoose.Types.ObjectId( data.id ) } : { team: data.teamName.toLowerCase() },
|
|
3537
|
-
},
|
|
3538
|
-
},
|
|
3539
|
-
];
|
|
3540
|
-
let teamDetails = await teamsServices.aggregateTeams( query );
|
|
3541
|
-
if ( teamDetails.length ) {
|
|
3542
|
-
if ( data.insert ) {
|
|
3543
|
-
assignedData = {
|
|
3544
|
-
checkFlag: true,
|
|
3545
|
-
checkListId: data.checklistId,
|
|
3546
|
-
checkListName: data.checkListName,
|
|
3547
|
-
client_id: data.clientId,
|
|
3548
|
-
teamName: teamDetails?.[0]?.teamName,
|
|
3549
|
-
assignId: data?.id || teamDetails?.[0]?._id,
|
|
3550
|
-
coverage: 'user',
|
|
3551
|
-
};
|
|
3552
|
-
} else {
|
|
3553
|
-
let userIdList = teamDetails[0].users.map( ( ele ) => ele.userId );
|
|
3554
|
-
let userDetails = await userService.find( { _id: userIdList } );
|
|
3555
|
-
assignedData = userDetails.map( ( user ) => {
|
|
3556
|
-
let userData = {
|
|
3557
|
-
userId: user._id,
|
|
3558
|
-
userName: user.userName,
|
|
3559
|
-
userEmail: user.email,
|
|
3560
|
-
userPhone: user.mobileNumber,
|
|
3561
|
-
checkFlag: true,
|
|
3562
|
-
checkListId: data.checklistId,
|
|
3563
|
-
checkListName: data.checkListName,
|
|
3564
|
-
client_id: data.clientId,
|
|
3565
|
-
assignId: data?.id || teamDetails?.[0]?._id,
|
|
3566
|
-
coverage: 'user',
|
|
3567
|
-
teamName: teamDetails?.[0]?.teamName,
|
|
3568
|
-
};
|
|
3569
|
-
return userData;
|
|
3570
|
-
} );
|
|
3571
|
-
}
|
|
3572
|
-
}
|
|
3573
|
-
} else {
|
|
3640
|
+
let taskDetails = await taskService.findOne( { _id: req.body.taskId, client_id: req.body.clientId } );
|
|
3641
|
+
if ( !taskDetails ) {
|
|
3642
|
+
return res.sendError( 'No data found', 204 );
|
|
3643
|
+
}
|
|
3644
|
+
req.body.assignedGroup = [ ...new Set( req.body.assignedGroup.map( ( item ) => item.id ) ) ];
|
|
3645
|
+
req.body.assignedGroup = req.body.assignedGroup.map( ( ele ) => {
|
|
3646
|
+
return { id: ele };
|
|
3647
|
+
} );
|
|
3648
|
+
await taskAssignService.deleteMany( { checkListId: req.body.taskId } );
|
|
3649
|
+
let assignedUserList = [];
|
|
3650
|
+
await Promise.all( req.body.assignedList.map( async ( assign ) => {
|
|
3574
3651
|
let query = [
|
|
3575
3652
|
{
|
|
3576
3653
|
$addFields: {
|
|
3577
|
-
|
|
3654
|
+
emailToLower: { $toLower: '$email' },
|
|
3578
3655
|
},
|
|
3579
3656
|
},
|
|
3580
3657
|
{
|
|
3581
3658
|
$match: {
|
|
3582
|
-
clientId:
|
|
3583
|
-
|
|
3659
|
+
clientId: req.body.clientId,
|
|
3660
|
+
emailToLower: assign.userEmail.toLowerCase(),
|
|
3584
3661
|
},
|
|
3585
3662
|
},
|
|
3586
3663
|
];
|
|
3587
|
-
// console.log( 'data?.userEmail=>', data.userEmail );
|
|
3588
3664
|
let userDetails = await userService.aggregate( query );
|
|
3589
3665
|
if ( !userDetails.length ) {
|
|
3590
3666
|
let userData = {
|
|
3591
|
-
userName:
|
|
3592
|
-
email:
|
|
3593
|
-
|
|
3594
|
-
|
|
3595
|
-
// console.log( userData, 'userData', data );
|
|
3596
|
-
let details = await createUser( userData );
|
|
3597
|
-
userDetails = [ details ];
|
|
3598
|
-
}
|
|
3599
|
-
if ( userDetails.length ) {
|
|
3600
|
-
assignedData = {
|
|
3601
|
-
userId: userDetails?.[0]?._id,
|
|
3602
|
-
userName: userDetails?.[0]?.userName,
|
|
3603
|
-
userEmail: userDetails?.[0]?.email,
|
|
3604
|
-
userPhone: userDetails?.[0]?.mobileNumber,
|
|
3605
|
-
checkFlag: true,
|
|
3606
|
-
checkListId: data.checklistId,
|
|
3607
|
-
checkListName: data.checkListName,
|
|
3608
|
-
client_id: data.clientId,
|
|
3609
|
-
assignId: data?.id || userDetails?.[0]?._id,
|
|
3610
|
-
coverage: 'user',
|
|
3667
|
+
userName: assign.userName,
|
|
3668
|
+
email: assign.userEmail,
|
|
3669
|
+
mobileNumber: assign?.phone || '',
|
|
3670
|
+
clientId: req.body.clientId,
|
|
3611
3671
|
};
|
|
3672
|
+
userDetails = await createUser( userData );
|
|
3612
3673
|
}
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
}
|
|
3623
|
-
|
|
3624
|
-
export async function assignTaskUser( req, res ) {
|
|
3625
|
-
try {
|
|
3626
|
-
let inputBody = req.body;
|
|
3627
|
-
let assignDetails = inputBody.assignUsers;
|
|
3628
|
-
let newUsers = inputBody.newUsers;
|
|
3629
|
-
let taskDetails = await taskService.findOne( { _id: inputBody.taskId } );
|
|
3630
|
-
if ( !taskDetails ) {
|
|
3631
|
-
return res.sendError( 'No data found', 204 );
|
|
3632
|
-
}
|
|
3633
|
-
// await Promise.all( newUsers.map( async ( user ) => {
|
|
3634
|
-
// let getUser = inputBody.assignUsers.find( ( ele ) => ele.userEmail.toLowerCase() == user.toLowerCase() );
|
|
3635
|
-
// let userData = {
|
|
3636
|
-
// userName: getUser.userName,
|
|
3637
|
-
// email: user,
|
|
3638
|
-
// mobileNumber: getUser?.phone,
|
|
3639
|
-
// clientId: inputBody.clientId,
|
|
3640
|
-
// };
|
|
3641
|
-
// await createUser( userData );
|
|
3642
|
-
// } ) );
|
|
3643
|
-
for ( let i = 0; i < newUsers.length; i++ ) {
|
|
3644
|
-
let getUser = inputBody.assignUsers.find( ( ele ) => ele.userEmail.toLowerCase() == newUsers[i].toLowerCase() );
|
|
3645
|
-
let userData = {
|
|
3646
|
-
userName: getUser.userName,
|
|
3647
|
-
email: newUsers[i],
|
|
3648
|
-
mobileNumber: getUser?.phone,
|
|
3649
|
-
clientId: inputBody.clientId,
|
|
3674
|
+
let data = {
|
|
3675
|
+
...assign,
|
|
3676
|
+
store_id: assign?.storeId,
|
|
3677
|
+
client_id: req.body.clientId,
|
|
3678
|
+
checkListId: req.body.taskId,
|
|
3679
|
+
coverage: req.body.coverage,
|
|
3680
|
+
assignId: assign._id,
|
|
3681
|
+
userId: userDetails._id,
|
|
3682
|
+
checkListName: taskDetails.checkListName,
|
|
3650
3683
|
};
|
|
3651
|
-
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
await Promise.all(
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
if (
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3666
|
-
|
|
3684
|
+
delete data._id;
|
|
3685
|
+
assignedUserList.push( data );
|
|
3686
|
+
} ) );
|
|
3687
|
+
await Promise.all( req.body.assignedGroup.map( async ( assign ) => {
|
|
3688
|
+
let groupDetails;
|
|
3689
|
+
if ( req.body.coverage == 'store' ) {
|
|
3690
|
+
groupDetails = await clusterServices.findOneCluster( { _id: assign.id } );
|
|
3691
|
+
} else {
|
|
3692
|
+
groupDetails = await teamsServices.findOneTeams( { _id: assign.id } );
|
|
3693
|
+
}
|
|
3694
|
+
if ( groupDetails ) {
|
|
3695
|
+
let groupData = {
|
|
3696
|
+
client_id: req.body.clientId,
|
|
3697
|
+
checkListId: req.body.taskId,
|
|
3698
|
+
coverage: req.body.coverage,
|
|
3699
|
+
assignId: assign.id,
|
|
3700
|
+
checkListName: taskDetails.checkListName,
|
|
3701
|
+
...( req.body.coverage == 'store' ) ? { clusterName: groupDetails?.clusterName } : { teamName: groupDetails?.teamName },
|
|
3702
|
+
};
|
|
3703
|
+
assignedUserList.push( groupData );
|
|
3667
3704
|
}
|
|
3668
3705
|
} ) );
|
|
3669
|
-
|
|
3706
|
+
await taskAssignService.insertMany( assignedUserList );
|
|
3707
|
+
return res.sendSuccess( 'Assign details updated successfully' );
|
|
3670
3708
|
} catch ( e ) {
|
|
3671
|
-
logger.error( { functionName: '
|
|
3709
|
+
logger.error( { functionName: 'updateAssign', error: e } );
|
|
3672
3710
|
return res.sendError( e, 500 );
|
|
3673
3711
|
}
|
|
3674
3712
|
}
|
|
3675
3713
|
|
|
3676
|
-
export async function customertrial( params ) {
|
|
3677
|
-
try {
|
|
3678
|
-
// let inputData = {
|
|
3679
|
-
// Bucket: 'tango-trax-audit',
|
|
3680
|
-
// file_path: 'trail/59-147/b1c5b15c0133dec0c45640d923fda221_10_09_59_000_24_01_2025_false.mp4',
|
|
3681
|
-
// };
|
|
3682
|
-
// let url = await signedUrl( inputData );
|
|
3683
|
-
// console.log( url );
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
let inputData = {
|
|
3687
|
-
Bucket: 'tango-trax-audit',
|
|
3688
|
-
Key: 'hygiene/16-01-2025/11-2212/11-2212_13d76f2dd3ea3123aa476a885893c9fd_labelled.jpeg',
|
|
3689
|
-
};
|
|
3690
|
-
|
|
3691
|
-
|
|
3692
|
-
let url = await getObject( inputData );
|
|
3693
|
-
console.log( url );
|
|
3694
|
-
} catch ( e ) {
|
|
3695
|
-
logger.error( 'uploadImage =>', e );
|
|
3696
|
-
return e;
|
|
3697
|
-
}
|
|
3698
|
-
};
|
|
3699
|
-
|
|
@@ -10,7 +10,7 @@ taskRouter
|
|
|
10
10
|
.post( '/delete/:taskIds', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.deleteTask )
|
|
11
11
|
.get( '/details', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [] } ] } ), taskController.taskDetails )
|
|
12
12
|
.get( '/userDetails', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [] } ] } ), taskController.userDetails )
|
|
13
|
-
.post( '/upload', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.
|
|
13
|
+
.post( '/upload', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.validateUserv1 )
|
|
14
14
|
.post( '/uploadImage', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.uploadImage )
|
|
15
15
|
.post( '/config', isAllowedSessionHandler, isAllowedClient, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.taskConfig )
|
|
16
16
|
.post( '/reinitiate', isAllowedSessionHandler, accessVerification( { userType: [ 'tango', 'client' ], access: [ { featureName: 'TangoTrax', name: 'Task', permissions: [ 'isEdit' ] } ] } ), taskController.reinitiateTask )
|
|
@@ -30,10 +30,11 @@ taskRouter
|
|
|
30
30
|
.post( '/createaiChecklist', isAllowedInternalAPIHandler, taskController.createAiChecklist )
|
|
31
31
|
.post( '/createaiTask', isAllowedInternalAPIHandler, taskController.createAiTask )
|
|
32
32
|
.post( '/assign', isAllowedSessionHandler, taskController.taskAssign )
|
|
33
|
-
.post( '/assignUpload', isAllowedSessionHandler, taskController.assignTaskUser )
|
|
33
|
+
// .post( '/assignUpload', isAllowedSessionHandler, taskController.assignTaskUser )
|
|
34
34
|
.post( '/createaiTask', isAllowedInternalAPIHandler, validate( aitaskvalidation ), taskController.createAiTask )
|
|
35
35
|
.post( '/StoreHygienetask', isAllowedInternalAPIHandler, validate( StoreHygienetaskvalidation ), taskController.StoreHygienetask )
|
|
36
36
|
.post( '/eyeTesttask', isAllowedInternalAPIHandler, validate( eyeTesttaskvalidation ), taskController.eyeTesttask )
|
|
37
|
-
.get( '/getcoustemer', taskController.customertrial )
|
|
37
|
+
.get( '/getcoustemer', taskController.customertrial )
|
|
38
|
+
.post( '/updateAssign', isAllowedSessionHandler, taskController.updateAssign );
|
|
38
39
|
|
|
39
40
|
|