tango-app-api-trax 3.3.1-beta-30 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tango-app-api-trax",
3
- "version": "3.3.1-beta-30",
3
+ "version": "3.3.1-beta-32",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -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,
@@ -2094,13 +2094,15 @@ export async function assignChecklistUser( req, res ) {
2094
2094
  assign.clientId = inputBody.clientId;
2095
2095
  assign.upload = inputBody.type;
2096
2096
  let uploadData = await assignUsers( assign );
2097
- if ( Array.isArray( uploadData ) ) {
2098
- assignData.push( ...uploadData );
2099
- } else {
2100
- assignData.push( uploadData );
2097
+ if ( uploadData ) {
2098
+ if ( Array.isArray( uploadData ) ) {
2099
+ assignData.push( ...uploadData );
2100
+ } else {
2101
+ assignData.push( uploadData );
2102
+ }
2101
2103
  }
2102
2104
  } ) );
2103
- return res.sendSuccess( { idList: [ ...new Set( assignData.map( ( item ) => item.assignId.toString() ) ) ], assignData } );
2105
+ return res.sendSuccess( { idList: [ ...new Set( assignData.map( ( item ) => item?.assignId?.toString() ) ) ], assignData } );
2104
2106
  } catch ( e ) {
2105
2107
  logger.error( { functionName: 'assignUser', error: e } );
2106
2108
  return res.sendError( e, 500 );
@@ -2891,7 +2893,7 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
2891
2893
  let clusterDetails = await clusterServices.findcluster( { _id: { $in: clusterList } } );
2892
2894
  if ( clusterDetails.length ) {
2893
2895
  let idList = clusterDetails.flatMap( ( item ) => item.stores.map( ( ele ) => ele.store ) );
2894
- let getStoreDetails = await storeService.find( { _id: { $in: idList } } );
2896
+ let getStoreDetails = await storeService.find( { _id: { $in: idList }, status: 'active' } );
2895
2897
  if ( getStoreDetails.length ) {
2896
2898
  assignList = await Promise.all( getStoreDetails.map( async ( store ) => {
2897
2899
  let userDetails = await userService.findOne( { email: store?.spocDetails?.[0]?.email, clientId: store.clientId } );
@@ -3565,7 +3567,7 @@ async function assignUsers( data ) {
3565
3567
  };
3566
3568
  } else {
3567
3569
  let clusterList = clusterDetails[0].stores.map( ( ele ) => ele.store );
3568
- let storeDetails = await storeService.find( { _id: clusterList } );
3570
+ let storeDetails = await storeService.find( { _id: { $in: clusterList }, status: 'active' } );
3569
3571
  assignedData = await Promise.all( storeDetails.map( async ( store ) => {
3570
3572
  let userDetails = await userService.findOne( { email: store.spocDetails?.[0]?.email, clientId: data.clientId } );
3571
3573
  if ( !userDetails ) {
@@ -3763,7 +3765,7 @@ export async function checklistAssign( req, res ) {
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
  }