tango-app-api-client 3.0.48-dev → 3.0.50-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-client",
3
- "version": "3.0.48-dev",
3
+ "version": "3.0.50-dev",
4
4
  "description": "client",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -25,7 +25,7 @@
25
25
  "mongodb": "^6.3.0",
26
26
  "nodemon": "^3.0.3",
27
27
  "swagger-ui-express": "^5.0.0",
28
- "tango-api-schema": "^2.0.108",
28
+ "tango-api-schema": "^2.0.110",
29
29
  "tango-app-api-middleware": "^3.1.12",
30
30
  "winston": "^3.11.0",
31
31
  "winston-daily-rotate-file": "^5.0.0"
@@ -1,8 +1,8 @@
1
1
  import { billingDetailsUpdate, brandInfoUpdate, domainDetailsConfigurationUpdate, featureConfigurationUpdate, getClientData, signatoryDetailsUpdate, ticketConfigurationUpdate, documentsUpdate, getUserData, auditConfigurationUpdate, auditConfigurationGet, CsmUsersGet, OpsUsersGet, userConfigurationUpdate, findClient, aggregateClient, createAuditQueue, findOne, insert, update, findOneClient, updateOneClient } from '../service/client.service.js';
2
2
  import { checkFileExist, fileUpload, signedUrl, chunkArray, download, logger, getOpenSearchData, insertOpenSearchData, appConfig, sendEmailWithSES } from 'tango-app-api-middleware';
3
3
  import { countDocumentsUser, findOneAndUpdateUser, findOneUser, getUserNameEmailById, updateManyUser } from '../service/user.service.js';
4
- import { aggregateStore, countDocumentsStore, findOneStore, updateManyStore } from '../service/store.service.js';
5
- import { aggregateCamera, countDocumentsCamera, updateManyCamera } from '../service/camera.service.js';
4
+ import { aggregateStore, countDocumentsStore, findStore, findOneStore, updateManyStore } from '../service/store.service.js';
5
+ import { aggregateCamera, countDocumentsCamera } from '../service/camera.service.js';
6
6
  import _ from 'lodash';
7
7
  import { findOneStandaredRole } from '../service/standaredRole.service.js';
8
8
  import { aggregateUserAssignedStore, deleteOneAssignedStore, updateOneUserAssignedStore } from '../service/userAssignedStore.service.js';
@@ -521,12 +521,16 @@ export async function detailedAllClientCount( req, res ) {
521
521
  },
522
522
  ];
523
523
  const result = await aggregateClient( query );
524
- const activeStores = await countDocumentsStore( { 'status': 'active', 'edge.firstFile': true } );
525
- const activeCameras = await countDocumentsCamera( { isUp: true, isActivated: true } );
524
+ const activeStores = await findStore( { 'status': 'active', 'edge.firstFile': true }, { storeId: 1 } );
525
+ let storesList = [];
526
+ for ( let store of activeStores ) {
527
+ storesList.push( store.storeId );
528
+ }
529
+ const activeCameras = await countDocumentsCamera( { storeId: { $in: storesList }, isUp: true, isActivated: true } );
526
530
  if ( result.length == 0 ) {
527
531
  return res.sendError( 'No Data Found', 204 );
528
532
  }
529
- result[0].activeStoresCount = activeStores;
533
+ result[0].activeStoresCount = activeStores.length;
530
534
  result[0].activeCameraCount = activeCameras;
531
535
  return res.sendSuccess( { result: result } );
532
536
  } catch ( error ) {
@@ -605,7 +609,7 @@ export async function updateBrandInfo( req, res ) {
605
609
 
606
610
  if ( req.body?.status === 'deactive' ) {
607
611
  await updateManyStore( { clientId: req.params?.id }, { status: 'deactive' } );
608
- await updateManyCamera( { clientId: req.params?.id }, { isUp: false, isActivated: false } );
612
+ // await updateManyCamera( { clientId: req.params?.id }, { isUp: false, isActivated: false } );
609
613
  await updateManyUser( { clientId: req.params?.id }, { isActive: false } );
610
614
  }
611
615
 
@@ -784,6 +788,7 @@ export async function updateFeatureConfiguration( req, res ) {
784
788
  close: req.body?.close, conversionCalculation: req.body?.conversionCalculation, conversionCondition: req.body?.conversionCondition,
785
789
  conversionValue: req.body?.conversionValue, infraAlertCondition: req.body?.infraAlertCondition, infraAlertValue: req.body?.infraAlertValue, isFootfallDirectory: req.body?.isFootfallDirectory,
786
790
  isNormalized: req.body?.isNormalized, isPasserByData: req.body?.isPasserByData, missedOpportunityCalculation: req.body?.missedOpportunityCalculation, open: req.body?.open,
791
+ isExcludedArea: req.body?.isExcludedArea,
787
792
  } );
788
793
 
789
794
  let updateKeys = [];
@@ -1707,6 +1712,19 @@ export async function detailedClientCount( req, res ) {
1707
1712
  result['userName'] = user?.userName;
1708
1713
  result['email'] = user?.email;
1709
1714
  result['profileCompletion'] = 70;
1715
+ let findCsm = await aggregateUserAssignedStore( [
1716
+ {
1717
+ $match: {
1718
+ clientId: inputData.clientId,
1719
+ tangoUserType: 'csm',
1720
+ },
1721
+ },
1722
+ ] );
1723
+
1724
+ if ( findCsm&&findCsm.length>0 ) {
1725
+ let finduser = await findOneUser( { email: findCsm[0].userEmail }, { userName: 1, email: 1, countryCode: 1, mobileNumber: 1 } );
1726
+ result['csm'] = finduser;
1727
+ }
1710
1728
 
1711
1729
  return res.sendSuccess( { result: result } );
1712
1730
  } catch ( error ) {
@@ -108,6 +108,7 @@ export const featureConfigurationSchemaBody = joi.object(
108
108
  isNormalized: joi.boolean().optional(),
109
109
  isPasserByData: joi.boolean().optional(),
110
110
  isFootfallDirectory: joi.boolean().optional(),
111
+ isExcludedArea: joi.boolean().optional(),
111
112
  },
112
113
  );
113
114
 
@@ -131,7 +131,7 @@ export function featureConfigurationUpdate( {
131
131
  clientId, billableCalculation, bouncedLimitCondition, bouncedLimitValue,
132
132
  close, conversionCalculation, conversionCondition,
133
133
  conversionValue, infraAlertCondition, infraAlertValue, isFootfallDirectory,
134
- isNormalized, isPasserByData, missedOpportunityCalculation, open,
134
+ isNormalized, isPasserByData, missedOpportunityCalculation, open, isExcludedArea,
135
135
  } ) {
136
136
  return clientModel.updateOne( { clientId: clientId },
137
137
  {
@@ -150,6 +150,7 @@ export function featureConfigurationUpdate( {
150
150
  'featureConfigs.isNormalized': isNormalized,
151
151
  'featureConfigs.isPasserByData': isPasserByData,
152
152
  'featureConfigs.isFootfallDirectory': isFootfallDirectory,
153
+ 'featureConfigs.isExcludedArea': isExcludedArea,
153
154
  },
154
155
  } );
155
156
  }
@@ -3,6 +3,9 @@ import storeModel from 'tango-api-schema/schema/store.model.js';
3
3
  export function countDocumentsStore( query ) {
4
4
  return storeModel.countDocuments( query );
5
5
  }
6
+ export function findStore( query ) {
7
+ return storeModel.find( query );
8
+ }
6
9
 
7
10
  export function aggregateStore( query ) {
8
11
  return storeModel.aggregate( query );