tango-app-api-infra 3.0.40-dev → 3.0.42-dev

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-infra",
3
- "version": "3.0.40-dev",
3
+ "version": "3.0.42-dev",
4
4
  "description": "infra",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -385,7 +385,7 @@ export async function emailUserList( req, res ) {
385
385
  $match: {
386
386
  userType: 'client',
387
387
  clientId: inputData.clientId,
388
- ...( inputData.role ) ? { role: inputData.role } : {},
388
+ role: inputData.role,
389
389
  },
390
390
  },
391
391
  {
@@ -465,19 +465,19 @@ export async function emailUserList( req, res ) {
465
465
  const result = await aggregateUser( query );
466
466
  for ( let user of result ) {
467
467
  if ( user.role == 'superadmin' ) {
468
- let storelist = await findStore( { clientId: user.clientId, status: 'active' }, { storeName: 1 } );
468
+ let storelist = await findStore( { clientId: inputData.clientId, status: 'active' }, { storeName: 1 } );
469
469
  user.assigned = storelist.length;
470
470
  user.assignedValue = storelist;
471
471
  } else if ( user.role != 'superadmin' ) {
472
472
  if ( user.assignedType == 'group' ) {
473
473
  for ( let group of user.assignedValue ) {
474
474
  let groupdata = await findOneGroup( { groupName: group } );
475
- let storelist = await findStore( { storeId: { $in: groupdata.storeList } }, { storeName: 1 } );
475
+ let storelist = await findStore( { clientId: inputData.clientId, storeId: { $in: groupdata.storeList } }, { storeName: 1 } );
476
476
  user.assigned = storelist.length;
477
477
  user.assignedValue = storelist;
478
478
  }
479
479
  } else if ( user.assignedType == 'store' ) {
480
- let storelist = await findStore( { storeId: { $in: user.assignedValue } }, { storeName: 1 } );
480
+ let storelist = await findStore( { clientId: inputData.clientId, storeId: { $in: user.assignedValue } }, { storeName: 1 } );
481
481
  user.assignedValue = storelist;
482
482
  }
483
483
  }
@@ -294,7 +294,8 @@ export async function emailUserList( req, res ) {
294
294
  let clientList = await aggregateClient( [
295
295
  {
296
296
  $match: {
297
- status: 'active',
297
+ 'status': 'active',
298
+
298
299
  // clientId:{ req.body.clientId},
299
300
  },
300
301
  },
@@ -314,8 +315,8 @@ export async function emailUserList( req, res ) {
314
315
  '$expr': {
315
316
  $and: [
316
317
  { '$eq': [ '$clientId', '$$clientId' ] },
317
- { '$eq': [ '$userType', 'client' ] },
318
-
318
+ { '$eq': [ '$clientId', '$$clientId' ] },
319
+ { '$eq': [ '$emailAlert.infra', true ] },
319
320
  ],
320
321
  },
321
322
  },