tango-app-api-trax 3.3.1-beta-53 → 3.3.1-beta-54
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
|
@@ -993,7 +993,7 @@ export const assignedUserDetailsv1 = async ( req, res ) => {
|
|
|
993
993
|
// let page = parseInt( req.query.offset ) || 0;
|
|
994
994
|
// let skip = limit * page;
|
|
995
995
|
|
|
996
|
-
let query = [ { $match: { checkListId: new ObjectId( req.params.checklistId ), isdeleted: false
|
|
996
|
+
let query = [ { $match: { checkListId: new ObjectId( req.params.checklistId ), isdeleted: false } } ];
|
|
997
997
|
|
|
998
998
|
query.push( { $sort: { _id: -1 } } );
|
|
999
999
|
|
|
@@ -1004,18 +1004,58 @@ export const assignedUserDetailsv1 = async ( req, res ) => {
|
|
|
1004
1004
|
|
|
1005
1005
|
let userDetails = [];
|
|
1006
1006
|
await Promise.all( checklistDetails.map( async ( ele ) => {
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1007
|
+
if ( ele?.clusterName ) {
|
|
1008
|
+
let clusterDetails = await clusterServices.findOneCluster( { _id: ele.assignId }, { stores: 1 } );
|
|
1009
|
+
if ( clusterDetails ) {
|
|
1010
|
+
let storeDetails = await storeService.find( { _id: { $in: clusterDetails.stores.map( ( item ) => item.store ) }, status: 'active' } );
|
|
1011
|
+
storeDetails.forEach( ( item ) => {
|
|
1012
|
+
userDetails.push( {
|
|
1013
|
+
id: ele._id,
|
|
1014
|
+
userName: item.spocDetails?.[0]?.name,
|
|
1015
|
+
userEmail: item.spocDetails?.[0]?.email,
|
|
1016
|
+
store_id: item?.storeId,
|
|
1017
|
+
storeName: item?.storeName,
|
|
1018
|
+
userPhone: item.spocDetails?.[0]?.phone,
|
|
1019
|
+
city: ele?.city,
|
|
1020
|
+
checkFlag: ele.checkFlag,
|
|
1021
|
+
clusterName: ele?.clusterName || '',
|
|
1022
|
+
teamName: ele?.teamName || '',
|
|
1023
|
+
} );
|
|
1024
|
+
} );
|
|
1025
|
+
}
|
|
1026
|
+
} else if ( ele?.teamName ) {
|
|
1027
|
+
let teamDetails = await teamsServices.findOneTeams( { _id: ele.assignId }, { users: 1, teamName: 1 } );
|
|
1028
|
+
if ( teamDetails ) {
|
|
1029
|
+
let teamUserDetails = await userService.find( { _id: { $in: teamDetails.users.map( ( item ) => item.userId ) } } );
|
|
1030
|
+
teamUserDetails.forEach( ( item ) => {
|
|
1031
|
+
userDetails.push( {
|
|
1032
|
+
id: ele._id,
|
|
1033
|
+
userName: item.userName,
|
|
1034
|
+
userEmail: item.email,
|
|
1035
|
+
store_id: ele?.storeId,
|
|
1036
|
+
storeName: ele?.storeName,
|
|
1037
|
+
userPhone: item?.mobileNumber,
|
|
1038
|
+
city: ele?.city,
|
|
1039
|
+
checkFlag: ele.checkFlag,
|
|
1040
|
+
clusterName: ele?.clusterName || '',
|
|
1041
|
+
teamName: ele?.teamName || '',
|
|
1042
|
+
} );
|
|
1043
|
+
} );
|
|
1044
|
+
}
|
|
1045
|
+
} else {
|
|
1046
|
+
userDetails.push( {
|
|
1047
|
+
id: ele._id,
|
|
1048
|
+
userName: ele.userName,
|
|
1049
|
+
userEmail: ele.userEmail,
|
|
1050
|
+
store_id: ele?.store_id,
|
|
1051
|
+
storeName: ele?.storeName,
|
|
1052
|
+
userPhone: ele.userPhone,
|
|
1053
|
+
city: ele.city,
|
|
1054
|
+
checkFlag: ele.checkFlag,
|
|
1055
|
+
clusterName: ele?.clusterName || '',
|
|
1056
|
+
teamName: ele?.teamName || '',
|
|
1057
|
+
} );
|
|
1058
|
+
}
|
|
1019
1059
|
} ) );
|
|
1020
1060
|
|
|
1021
1061
|
return res.sendSuccess( { count: userDetails.length, userDetails } );
|