tango-app-api-trax 3.3.1-beta-52 → 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-trax",
3
- "version": "3.3.1-beta-52",
3
+ "version": "3.3.1-beta-54",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -993,17 +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 ), ...( req.query.coverage ) ? { coverage: req.query.coverage } : {}, isdeleted: false } } ];
997
- if ( req.query.search.trim() && req.query.search.trim() != '' ) {
998
- let searchValue = req.query.search;
999
- searchValue = searchValue.split( ',' ).map( ( item ) => item.trim().toLowerCase() );
1000
- if ( searchValue.length > 1 ) {
1001
- query.push( { $addFields: { storeLower: { $toLower: '$storeName' } } } );
1002
- query.push( { $match: { storeLower: { $in: searchValue } } } );
1003
- } else {
1004
- query.push( { $match: { storeName: { $regex: req.query.search.trim(), $options: 'i' } } } );
1005
- }
1006
- }
996
+ let query = [ { $match: { checkListId: new ObjectId( req.params.checklistId ), isdeleted: false } } ];
1007
997
 
1008
998
  query.push( { $sort: { _id: -1 } } );
1009
999
 
@@ -1013,15 +1003,7 @@ export const assignedUserDetailsv1 = async ( req, res ) => {
1013
1003
  }
1014
1004
 
1015
1005
  let userDetails = [];
1016
- let storeList = [];
1017
- let userList = [];
1018
1006
  await Promise.all( checklistDetails.map( async ( ele ) => {
1019
- if ( ele?.store_id || ele?.clusterName ) {
1020
- storeList.push( ele.assignId );
1021
- } else {
1022
- userList.push( ele.assignId );
1023
- }
1024
-
1025
1007
  if ( ele?.clusterName ) {
1026
1008
  let clusterDetails = await clusterServices.findOneCluster( { _id: ele.assignId }, { stores: 1 } );
1027
1009
  if ( clusterDetails ) {
@@ -1076,7 +1058,7 @@ export const assignedUserDetailsv1 = async ( req, res ) => {
1076
1058
  }
1077
1059
  } ) );
1078
1060
 
1079
- return res.sendSuccess( { count: userDetails.length, storeList, userList, users: limitedData } );
1061
+ return res.sendSuccess( { count: userDetails.length, userDetails } );
1080
1062
  } catch ( e ) {
1081
1063
  logger.error( 'assignedUserDetails =>', e );
1082
1064
  return res.sendError( e, 500 );
@@ -3568,7 +3550,7 @@ export const selectAssign = async ( req, res ) => {
3568
3550
  if ( requestData.assignType == 'user' ) {
3569
3551
  let userQuery = [
3570
3552
  { $match: { clientId: requestData.clientId } },
3571
- { $project: { 'email': 1, 'userName': 1, 'type': 'user' } },
3553
+ { $project: { 'userEmail': '$email', 'userName': 1, 'type': 'user' } },
3572
3554
  ];
3573
3555
  resuldData = await userService.aggregate( userQuery );
3574
3556
  } else {
@@ -3681,8 +3663,6 @@ export async function updateAssign( req, res ) {
3681
3663
  await assignedService.deleteMany( { checkListId: req.body.checkListId } );
3682
3664
  let assignedUserList = [];
3683
3665
  await Promise.all( req.body.assignedList.map( async ( assign ) => {
3684
- delete assign._id;
3685
- delete assign.id;
3686
3666
  let query = [
3687
3667
  {
3688
3668
  $addFields: {
@@ -3716,6 +3696,7 @@ export async function updateAssign( req, res ) {
3716
3696
  userId: userDetails._id,
3717
3697
  checkListName: checklistDetails.checkListName,
3718
3698
  };
3699
+ delete data._id;
3719
3700
  assignedUserList.push( data );
3720
3701
  } ) );
3721
3702
  await Promise.all( req.body.assignedGroup.map( async ( assign ) => {