tango-app-api-task 3.2.1-beta-22 → 3.2.1-beta-24

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-task",
3
- "version": "3.2.1-beta-22",
3
+ "version": "3.2.1-beta-24",
4
4
  "description": "Task",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -597,7 +597,7 @@ export async function userDetails( req, res ) {
597
597
  if ( ele?.clusterName ) {
598
598
  let clusterDetails = await clusterServices.findOneCluster( { _id: ele.assignId }, { stores: 1 } );
599
599
  if ( clusterDetails ) {
600
- let storeDetails = await storeService.find( { _id: { $in: clusterDetails.stores.map( ( item ) => item.store ) } } );
600
+ let storeDetails = await storeService.find( { _id: { $in: clusterDetails.stores.map( ( item ) => item.store ) }, status: 'active' } );
601
601
  storeDetails.forEach( ( item ) => {
602
602
  userDetails.push( {
603
603
  id: ele._id,
@@ -935,7 +935,7 @@ async function insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, date,
935
935
  let clusterDetails = await clusterServices.findcluster( { _id: { $in: clusterList } } );
936
936
  if ( clusterDetails.length ) {
937
937
  let idList = clusterDetails.flatMap( ( item ) => item.stores.map( ( ele ) => ele.store ) );
938
- let getStoreDetails = await storeService.find( { _id: { $in: idList } } );
938
+ let getStoreDetails = await storeService.find( { _id: { $in: idList }, status: 'active' } );
939
939
  if ( getStoreDetails.length ) {
940
940
  assignList = await Promise.all( getStoreDetails.map( async ( store ) => {
941
941
  let userDetails = await userService.findOne( { email: store?.spocDetails?.[0]?.email, clientId: store.clientId } );
@@ -3367,7 +3367,7 @@ export async function taskAssign( req, res ) {
3367
3367
  } else {
3368
3368
  idList = req.body.idList;
3369
3369
  }
3370
- let getStoreDetails = await storeService.find( { _id: { $in: idList } } );
3370
+ let getStoreDetails = await storeService.find( { _id: { $in: idList }, status: 'active' } );
3371
3371
  if ( !getStoreDetails.length ) {
3372
3372
  return res.sendError( 'No data found', 204 );
3373
3373
  }
@@ -3463,7 +3463,7 @@ async function assignUsers( data ) {
3463
3463
  };
3464
3464
  } else {
3465
3465
  let clusterList = clusterDetails[0].stores.map( ( ele ) => ele.store );
3466
- let storeDetails = await storeService.find( { _id: clusterList } );
3466
+ let storeDetails = await storeService.find( { _id: { $in: clusterList }, status: 'active' } );
3467
3467
  assignedData = await Promise.all( storeDetails.map( async ( store ) => {
3468
3468
  let userDetails = await userService.findOne( { email: store.spocDetails?.[0]?.email, clientId: data.clientId } );
3469
3469
  if ( !userDetails ) {
@@ -3659,13 +3659,15 @@ export async function assignTaskUser( req, res ) {
3659
3659
  assign.clientId = inputBody.clientId;
3660
3660
  assign.upload = inputBody.type;
3661
3661
  let uploadData = await assignUsers( assign );
3662
- if ( Array.isArray( uploadData ) ) {
3663
- assignData.push( ...uploadData );
3664
- } else {
3665
- assignData.push( uploadData );
3662
+ if ( uploadData ) {
3663
+ if ( Array.isArray( uploadData ) ) {
3664
+ assignData.push( ...uploadData );
3665
+ } else {
3666
+ assignData.push( uploadData );
3667
+ }
3666
3668
  }
3667
3669
  } ) );
3668
- return res.sendSuccess( { idList: [ ...new Set( assignData.map( ( item ) => item.assignId ) ) ], assignData } );
3670
+ return res.sendSuccess( { idList: [ ...new Set( assignData.map( ( item ) => item?.assignId?.toString() ) ) ], assignData } );
3669
3671
  } catch ( e ) {
3670
3672
  logger.error( { functionName: 'assignTaskUser', error: e } );
3671
3673
  return res.sendError( e, 500 );