tango-app-api-trax 3.3.1-beta-29 → 3.3.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 +2 -2
- package/src/controllers/gallery.controller.js +3 -1
- package/src/controllers/trax.controller.js +145 -142
- package/src/hbs/login-otp.hbs +943 -943
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-32",
|
|
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.52",
|
|
30
30
|
"tango-app-api-middleware": "^3.1.55",
|
|
31
31
|
"url": "^0.11.4",
|
|
32
32
|
"winston": "^3.13.1",
|
|
@@ -292,11 +292,13 @@ export async function approveChecklist( req, res ) {
|
|
|
292
292
|
if ( updateResponse.modifiedCount || updateResponse.matchedCount ) {
|
|
293
293
|
let inputstores = checklistDetails.filter( ( data ) => data.checklistStatus == 'submit' );
|
|
294
294
|
|
|
295
|
+
|
|
295
296
|
let params = {
|
|
296
297
|
'payload': {
|
|
297
298
|
sourceCheckList_id: req.body.sourceCheckList_id,
|
|
298
299
|
fromDate: req.body.fromDate,
|
|
299
300
|
toDate: req.body.toDate,
|
|
301
|
+
filtertype: req.body.filtertype,
|
|
300
302
|
store_id: inputstores,
|
|
301
303
|
},
|
|
302
304
|
'upsert': {
|
|
@@ -314,7 +316,7 @@ export async function approveChecklist( req, res ) {
|
|
|
314
316
|
let url = JSON.parse( process.env.LAMBDAURL );
|
|
315
317
|
let searchResponse = await fetch( url.approveChecklist, requestOptions );
|
|
316
318
|
|
|
317
|
-
|
|
319
|
+
console.log( searchResponse.ok );
|
|
318
320
|
if ( searchResponse.ok ) {
|
|
319
321
|
let pendingstores = checklistDetails.filter( ( data ) => data.checklistStatus != 'submit' );
|
|
320
322
|
if ( pendingstores && pendingstores.length > 0 ) {
|
|
@@ -895,7 +895,7 @@ export const assignedUserDetails = async ( req, res ) => {
|
|
|
895
895
|
if ( ele?.clusterName ) {
|
|
896
896
|
let clusterDetails = await clusterServices.findOneCluster( { _id: ele.assignId }, { stores: 1 } );
|
|
897
897
|
if ( clusterDetails ) {
|
|
898
|
-
let storeDetails = await storeService.find( { _id: { $in: clusterDetails.stores.map( ( item ) => item.store ) } } );
|
|
898
|
+
let storeDetails = await storeService.find( { _id: { $in: clusterDetails.stores.map( ( item ) => item.store ) }, status: 'active' } );
|
|
899
899
|
storeDetails.forEach( ( item ) => {
|
|
900
900
|
userDetails.push( {
|
|
901
901
|
id: ele._id,
|
|
@@ -1004,7 +1004,7 @@ export const assignedUserDetailsv1 = async ( req, res ) => {
|
|
|
1004
1004
|
if ( ele?.clusterName ) {
|
|
1005
1005
|
let clusterDetails = await clusterServices.findOneCluster( { _id: ele.assignId }, { stores: 1 } );
|
|
1006
1006
|
if ( clusterDetails ) {
|
|
1007
|
-
let storeDetails = await storeService.find( { _id: { $in: clusterDetails.stores.map( ( item ) => item.store ) } } );
|
|
1007
|
+
let storeDetails = await storeService.find( { _id: { $in: clusterDetails.stores.map( ( item ) => item.store ) }, status: 'active' } );
|
|
1008
1008
|
storeDetails.forEach( ( item ) => {
|
|
1009
1009
|
userDetails.push( {
|
|
1010
1010
|
id: ele._id,
|
|
@@ -1989,11 +1989,6 @@ export const validateUserv1 = async ( req, res ) => {
|
|
|
1989
1989
|
return res.sendError( 'User already Exists', 400 );
|
|
1990
1990
|
}
|
|
1991
1991
|
}
|
|
1992
|
-
// let userChunk =await chunkArray( users, 10 );
|
|
1993
|
-
|
|
1994
|
-
await Promise.all( users.map( async ( chunk ) => {
|
|
1995
|
-
await processUser( [ chunk ] );
|
|
1996
|
-
} ) );
|
|
1997
1992
|
|
|
1998
1993
|
let userEmailList = assignDetails.map( ( item ) => item.userEmail.toLowerCase() );
|
|
1999
1994
|
let storeList = assignDetails.map( ( item ) => item.storeName.toLowerCase() );
|
|
@@ -2015,6 +2010,23 @@ export const validateUserv1 = async ( req, res ) => {
|
|
|
2015
2010
|
},
|
|
2016
2011
|
];
|
|
2017
2012
|
|
|
2013
|
+
let emailCheckQuery = [
|
|
2014
|
+
{
|
|
2015
|
+
$project: {
|
|
2016
|
+
newEmail: { $toLower: '$email' },
|
|
2017
|
+
isActive: 1,
|
|
2018
|
+
clientId: 1,
|
|
2019
|
+
},
|
|
2020
|
+
},
|
|
2021
|
+
{
|
|
2022
|
+
$match: {
|
|
2023
|
+
newEmail: { $in: userEmailList },
|
|
2024
|
+
isActive: true,
|
|
2025
|
+
clientId: { $ne: req.body.clientId },
|
|
2026
|
+
},
|
|
2027
|
+
},
|
|
2028
|
+
];
|
|
2029
|
+
|
|
2018
2030
|
let storeQuery = [
|
|
2019
2031
|
{
|
|
2020
2032
|
$project: {
|
|
@@ -2032,9 +2044,10 @@ export const validateUserv1 = async ( req, res ) => {
|
|
|
2032
2044
|
},
|
|
2033
2045
|
];
|
|
2034
2046
|
|
|
2035
|
-
let [ userDetails, storeDetails ] = await Promise.all[
|
|
2047
|
+
let [ userDetails, storeDetails, existEmail ] = await Promise.all[
|
|
2036
2048
|
await userService.aggregate( userQuery ),
|
|
2037
|
-
await storeService.aggregate( storeQuery )
|
|
2049
|
+
await storeService.aggregate( storeQuery ),
|
|
2050
|
+
await userService.aggregate( emailCheckQuery )
|
|
2038
2051
|
];
|
|
2039
2052
|
|
|
2040
2053
|
let existUSerEmail = userDetails.map( ( ele ) => ele.email );
|
|
@@ -2044,8 +2057,8 @@ export const validateUserv1 = async ( req, res ) => {
|
|
|
2044
2057
|
let existsStore = storeDetails.map( ( ele ) => ele.storeName );
|
|
2045
2058
|
storeDetails = storeList.filter( ( ele ) => !existsStore.includes( ele ) );
|
|
2046
2059
|
|
|
2047
|
-
if ( userDetails.length || storeDetails.length ) {
|
|
2048
|
-
return res.sendError( { validate: false, user: userDetails, store: storeDetails }, 400 );
|
|
2060
|
+
if ( userDetails.length || storeDetails.length || existEmail.length ) {
|
|
2061
|
+
return res.sendError( { validate: false, user: userDetails, store: storeDetails, existEmail }, 400 );
|
|
2049
2062
|
}
|
|
2050
2063
|
return res.sendSuccess( { validate: true } );
|
|
2051
2064
|
} catch ( e ) {
|
|
@@ -2073,15 +2086,23 @@ export async function assignChecklistUser( req, res ) {
|
|
|
2073
2086
|
};
|
|
2074
2087
|
await createUser( userData );
|
|
2075
2088
|
} ) );
|
|
2076
|
-
let assignData =
|
|
2077
|
-
|
|
2089
|
+
let assignData = [];
|
|
2090
|
+
await Promise.all( assignDetails.map( async ( assign ) => {
|
|
2091
|
+
assign.checklistId = inputBody.taskId;
|
|
2078
2092
|
assign.checkListName = checklistDetails.checkListName;
|
|
2079
2093
|
assign.coverage = inputBody.coverage;
|
|
2080
2094
|
assign.clientId = inputBody.clientId;
|
|
2081
2095
|
assign.upload = inputBody.type;
|
|
2082
|
-
|
|
2096
|
+
let uploadData = await assignUsers( assign );
|
|
2097
|
+
if ( uploadData ) {
|
|
2098
|
+
if ( Array.isArray( uploadData ) ) {
|
|
2099
|
+
assignData.push( ...uploadData );
|
|
2100
|
+
} else {
|
|
2101
|
+
assignData.push( uploadData );
|
|
2102
|
+
}
|
|
2103
|
+
}
|
|
2083
2104
|
} ) );
|
|
2084
|
-
return res.sendSuccess( { idList: assignData.map( ( item ) => item
|
|
2105
|
+
return res.sendSuccess( { idList: [ ...new Set( assignData.map( ( item ) => item?.assignId?.toString() ) ) ], assignData } );
|
|
2085
2106
|
} catch ( e ) {
|
|
2086
2107
|
logger.error( { functionName: 'assignUser', error: e } );
|
|
2087
2108
|
return res.sendError( e, 500 );
|
|
@@ -2872,7 +2893,7 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
|
|
|
2872
2893
|
let clusterDetails = await clusterServices.findcluster( { _id: { $in: clusterList } } );
|
|
2873
2894
|
if ( clusterDetails.length ) {
|
|
2874
2895
|
let idList = clusterDetails.flatMap( ( item ) => item.stores.map( ( ele ) => ele.store ) );
|
|
2875
|
-
let getStoreDetails = await storeService.find( { _id: { $in: idList } } );
|
|
2896
|
+
let getStoreDetails = await storeService.find( { _id: { $in: idList }, status: 'active' } );
|
|
2876
2897
|
if ( getStoreDetails.length ) {
|
|
2877
2898
|
assignList = await Promise.all( getStoreDetails.map( async ( store ) => {
|
|
2878
2899
|
let userDetails = await userService.findOne( { email: store?.spocDetails?.[0]?.email, clientId: store.clientId } );
|
|
@@ -2882,82 +2903,8 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
|
|
|
2882
2903
|
userName: store.spocDetails?.[0]?.name,
|
|
2883
2904
|
mobileNumber: store.spocDetails?.[0]?.phone || '',
|
|
2884
2905
|
email: store.spocDetails[0].email,
|
|
2885
|
-
password: '5dqFKAJj29PsV6P+kL+3Dw==',
|
|
2886
|
-
role: 'user',
|
|
2887
|
-
userType: 'client',
|
|
2888
|
-
rolespermission: [
|
|
2889
|
-
{
|
|
2890
|
-
featureName: 'Global',
|
|
2891
|
-
modules: [
|
|
2892
|
-
{
|
|
2893
|
-
name: 'Store',
|
|
2894
|
-
isAdd: false,
|
|
2895
|
-
isEdit: false,
|
|
2896
|
-
|
|
2897
|
-
},
|
|
2898
|
-
{
|
|
2899
|
-
name: 'User',
|
|
2900
|
-
isAdd: false,
|
|
2901
|
-
isEdit: false,
|
|
2902
|
-
|
|
2903
|
-
},
|
|
2904
|
-
{
|
|
2905
|
-
name: 'Camera',
|
|
2906
|
-
isAdd: false,
|
|
2907
|
-
isEdit: false,
|
|
2908
|
-
|
|
2909
|
-
},
|
|
2910
|
-
{
|
|
2911
|
-
name: 'Configuration',
|
|
2912
|
-
isAdd: false,
|
|
2913
|
-
isEdit: false,
|
|
2914
|
-
|
|
2915
|
-
},
|
|
2916
|
-
{
|
|
2917
|
-
name: 'Subscription',
|
|
2918
|
-
isAdd: false,
|
|
2919
|
-
isEdit: false,
|
|
2920
|
-
|
|
2921
|
-
},
|
|
2922
|
-
{
|
|
2923
|
-
name: 'Billing',
|
|
2924
|
-
isAdd: false,
|
|
2925
|
-
isEdit: false,
|
|
2926
|
-
|
|
2927
|
-
},
|
|
2928
|
-
],
|
|
2929
|
-
},
|
|
2930
|
-
{
|
|
2931
|
-
featurName: 'TangoEye',
|
|
2932
|
-
modules: [
|
|
2933
|
-
{
|
|
2934
|
-
name: 'ZoneTag',
|
|
2935
|
-
isAdd: false,
|
|
2936
|
-
isEdit: false,
|
|
2937
|
-
|
|
2938
|
-
},
|
|
2939
|
-
],
|
|
2940
|
-
},
|
|
2941
|
-
{
|
|
2942
|
-
featurName: 'TangoTrax',
|
|
2943
|
-
modules: [
|
|
2944
|
-
{
|
|
2945
|
-
name: 'checklist',
|
|
2946
|
-
isAdd: false,
|
|
2947
|
-
isEdit: false,
|
|
2948
|
-
|
|
2949
|
-
},
|
|
2950
|
-
{
|
|
2951
|
-
name: 'Task',
|
|
2952
|
-
isAdd: false,
|
|
2953
|
-
isEdit: false,
|
|
2954
|
-
|
|
2955
|
-
},
|
|
2956
|
-
],
|
|
2957
|
-
},
|
|
2958
|
-
],
|
|
2959
2906
|
};
|
|
2960
|
-
userDetails = await
|
|
2907
|
+
userDetails = await createUser( data );
|
|
2961
2908
|
}
|
|
2962
2909
|
let data = {
|
|
2963
2910
|
store_id: store?.storeId,
|
|
@@ -3175,35 +3122,37 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
|
|
|
3175
3122
|
}
|
|
3176
3123
|
}
|
|
3177
3124
|
}
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3125
|
+
if ( !userIdList.includes( element4._id ) ) {
|
|
3126
|
+
delete element4._id;
|
|
3127
|
+
delete element4.checkFlag;
|
|
3128
|
+
delete element4.isdeleted;
|
|
3129
|
+
delete element4.createdAt;
|
|
3130
|
+
delete element4.updatedAt;
|
|
3131
|
+
element4.checkListId = updatedchecklist._id;
|
|
3132
|
+
element4.checkListName = getCLconfig.checkListName;
|
|
3133
|
+
element4.checkListDescription = getCLconfig.checkListDescription;
|
|
3134
|
+
element4.date_iso = new Date( date );
|
|
3135
|
+
element4.date_string = dayjs( currentdate ).format( 'YYYY-MM-DD' );
|
|
3136
|
+
element4.allowedOverTime = getCLconfig.allowedOverTime;
|
|
3137
|
+
element4.allowedStoreLocation = getCLconfig.allowedStoreLocation;
|
|
3138
|
+
element4.scheduleStartTime = getCLconfig.scheduleStartTime;
|
|
3139
|
+
element4.scheduleStartTime_iso = startTimeIso.format();
|
|
3140
|
+
element4.scheduleEndTime = getCLconfig.scheduleEndTime;
|
|
3141
|
+
element4.scheduleEndTime_iso = endTimeIso.format();
|
|
3142
|
+
element4.createdBy = new ObjectId( getCLconfig.createdBy );
|
|
3143
|
+
element4.createdByName = getCLconfig.createdByName;
|
|
3144
|
+
element4.sourceCheckList_id = getCLconfig._id;
|
|
3145
|
+
element4.checkListType = getCLconfig.checkListType;
|
|
3146
|
+
element4.storeCount = getCLconfig.storeCount;
|
|
3147
|
+
element4.questionCount = getCLconfig.questionCount;
|
|
3148
|
+
element4.publishDate = getCLconfig.publishDate;
|
|
3149
|
+
element4.locationCount = getCLconfig.locationCount;
|
|
3150
|
+
element4.scheduleRepeatedType = getCLconfig.scheduleRepeatedType;
|
|
3151
|
+
element4.approvalEnable = getCLconfig.approver.length ? true : false;
|
|
3152
|
+
element4.remainder = getCLconfig?.remainder || [];
|
|
3153
|
+
element4.restrictAttendance = getCLconfig?.restrictAttendance;
|
|
3154
|
+
assignUserList.push( { ...element4 } );
|
|
3155
|
+
}
|
|
3207
3156
|
} ) );
|
|
3208
3157
|
|
|
3209
3158
|
if ( userIdList.length ) {
|
|
@@ -3606,15 +3555,46 @@ async function assignUsers( data ) {
|
|
|
3606
3555
|
];
|
|
3607
3556
|
let clusterDetails = await clusterServices.aggregateCluster( query );
|
|
3608
3557
|
if ( clusterDetails.length ) {
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3558
|
+
if ( !data.upload ) {
|
|
3559
|
+
assignedData = {
|
|
3560
|
+
checkFlag: true,
|
|
3561
|
+
checkListId: data.checklistId,
|
|
3562
|
+
checkListName: data.checkListName,
|
|
3563
|
+
client_id: data?.clientId,
|
|
3564
|
+
clusterName: clusterDetails?.[0]?.clusterName,
|
|
3565
|
+
assignId: data?.id || clusterDetails?.[0]?._id,
|
|
3566
|
+
coverage: 'store',
|
|
3567
|
+
};
|
|
3568
|
+
} else {
|
|
3569
|
+
let clusterList = clusterDetails[0].stores.map( ( ele ) => ele.store );
|
|
3570
|
+
let storeDetails = await storeService.find( { _id: { $in: clusterList }, status: 'active' } );
|
|
3571
|
+
assignedData = await Promise.all( storeDetails.map( async ( store ) => {
|
|
3572
|
+
let userDetails = await userService.findOne( { email: store.spocDetails?.[0]?.email, clientId: data.clientId } );
|
|
3573
|
+
if ( !userDetails ) {
|
|
3574
|
+
let userData = {
|
|
3575
|
+
userName: store.spocDetails?.[0]?.name,
|
|
3576
|
+
email: store.spocDetails[0].email,
|
|
3577
|
+
mobileNumber: store.spocDetails?.[0]?.phone,
|
|
3578
|
+
clientId: data.clientId,
|
|
3579
|
+
};
|
|
3580
|
+
userDetails = await createUser( userData );
|
|
3581
|
+
}
|
|
3582
|
+
let userData = {
|
|
3583
|
+
userId: userDetails?._id,
|
|
3584
|
+
userName: userDetails?.userName,
|
|
3585
|
+
userEmail: userDetails?.email,
|
|
3586
|
+
userPhone: userDetails?.mobileNumber,
|
|
3587
|
+
checkFlag: true,
|
|
3588
|
+
checkListId: data.checklistId,
|
|
3589
|
+
checkListName: data.checkListName,
|
|
3590
|
+
client_id: data.clientId,
|
|
3591
|
+
assignId: data?.id || clusterDetails?.[0]?._id,
|
|
3592
|
+
coverage: 'store',
|
|
3593
|
+
teamName: clusterDetails?.[0]?.clusterName,
|
|
3594
|
+
};
|
|
3595
|
+
return userData;
|
|
3596
|
+
} ) );
|
|
3597
|
+
}
|
|
3618
3598
|
}
|
|
3619
3599
|
} else {
|
|
3620
3600
|
let query = [
|
|
@@ -3676,17 +3656,38 @@ async function assignUsers( data ) {
|
|
|
3676
3656
|
},
|
|
3677
3657
|
},
|
|
3678
3658
|
];
|
|
3679
|
-
let teamDetails = await teamsServices.
|
|
3659
|
+
let teamDetails = await teamsServices.aggregateTeams( query );
|
|
3680
3660
|
if ( teamDetails.length ) {
|
|
3681
|
-
|
|
3682
|
-
|
|
3683
|
-
|
|
3684
|
-
|
|
3685
|
-
|
|
3686
|
-
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3661
|
+
if ( !data.upload ) {
|
|
3662
|
+
assignedData = {
|
|
3663
|
+
checkFlag: true,
|
|
3664
|
+
checkListId: data.checklistId,
|
|
3665
|
+
checkListName: data.checkListName,
|
|
3666
|
+
client_id: data.clientId,
|
|
3667
|
+
teamName: teamDetails?.[0]?.teamName,
|
|
3668
|
+
assignId: data?.id || teamDetails?.[0]?._id,
|
|
3669
|
+
coverage: 'user',
|
|
3670
|
+
};
|
|
3671
|
+
} else {
|
|
3672
|
+
let userIdList = teamDetails[0].users.map( ( ele ) => ele.userId );
|
|
3673
|
+
let userDetails = await userService.find( { _id: userIdList } );
|
|
3674
|
+
assignedData = userDetails.map( ( user ) => {
|
|
3675
|
+
let userData = {
|
|
3676
|
+
userId: user._id,
|
|
3677
|
+
userName: user.userName,
|
|
3678
|
+
userEmail: user.email,
|
|
3679
|
+
userPhone: user.mobileNumber,
|
|
3680
|
+
checkFlag: true,
|
|
3681
|
+
checkListId: data.checklistId,
|
|
3682
|
+
checkListName: data.checkListName,
|
|
3683
|
+
client_id: data.clientId,
|
|
3684
|
+
assignId: data?.id || teamDetails?.[0]?._id,
|
|
3685
|
+
coverage: 'user',
|
|
3686
|
+
teamName: teamDetails?.[0]?.teamName,
|
|
3687
|
+
};
|
|
3688
|
+
return userData;
|
|
3689
|
+
} );
|
|
3690
|
+
}
|
|
3690
3691
|
}
|
|
3691
3692
|
} else {
|
|
3692
3693
|
let query = [
|
|
@@ -3756,14 +3757,15 @@ export async function checklistAssign( req, res ) {
|
|
|
3756
3757
|
if ( req.body.coverage == 'store' ) {
|
|
3757
3758
|
let clusterDetails = await clusterServices.findcluster( { _id: { $in: req.body.idList } }, { stores: 1, clusterName: 1 } );
|
|
3758
3759
|
if ( clusterDetails.length ) {
|
|
3760
|
+
let clusterList = clusterDetails.map( ( item ) => item._id.toString() );
|
|
3759
3761
|
idList = [
|
|
3760
3762
|
...clusterDetails.flatMap( ( item ) => item.stores.map( ( ele ) => ele.store ) ),
|
|
3761
|
-
...
|
|
3763
|
+
...req.body.idList.filter( ( ele ) => !clusterList.includes( ele._id ) ),
|
|
3762
3764
|
];
|
|
3763
3765
|
} else {
|
|
3764
3766
|
idList = req.body.idList;
|
|
3765
3767
|
}
|
|
3766
|
-
let getStoreDetails = await storeService.find( { _id: { $in: idList } } );
|
|
3768
|
+
let getStoreDetails = await storeService.find( { _id: { $in: idList }, status: 'active' } );
|
|
3767
3769
|
if ( !getStoreDetails.length ) {
|
|
3768
3770
|
return res.sendError( 'No data found', 204 );
|
|
3769
3771
|
}
|
|
@@ -3792,9 +3794,10 @@ export async function checklistAssign( req, res ) {
|
|
|
3792
3794
|
} else {
|
|
3793
3795
|
let teamDetails = await teamsServices.findteams( { _id: { $in: req.body.idList } }, { users: 1, teamName: 1 } );
|
|
3794
3796
|
if ( teamDetails.length ) {
|
|
3797
|
+
let teamList = teamDetails.map( ( item ) => item._id.toString() );
|
|
3795
3798
|
idList = [
|
|
3796
3799
|
...teamDetails.flatMap( ( item ) => item.users.map( ( ele ) => ele.userId ) ),
|
|
3797
|
-
...
|
|
3800
|
+
...req.body.idList.filter( ( ele ) => !teamList.includes( ele._id ) ),
|
|
3798
3801
|
];
|
|
3799
3802
|
} else {
|
|
3800
3803
|
idList = req.body.idList;
|