tango-app-api-client 3.3.2-beta.3 → 3.3.2-beta.5

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.3.2-beta.3",
3
+ "version": "3.3.2-beta.5",
4
4
  "description": "client",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -19,13 +19,15 @@
19
19
  "express": "^4.18.2",
20
20
  "express-fileupload": "^1.4.3",
21
21
  "handlebars": "^4.7.8",
22
+ "i": "^0.3.7",
22
23
  "joi": "^17.12.1",
23
24
  "joi-to-swagger": "^6.2.0",
24
25
  "lodash": "^4.17.21",
25
26
  "mongodb": "^6.3.0",
26
27
  "nodemon": "^3.0.3",
28
+ "npm": "^10.9.1",
27
29
  "swagger-ui-express": "^5.0.0",
28
- "tango-api-schema": "^2.1.64",
30
+ "tango-api-schema": "^2.1.85",
29
31
  "tango-app-api-middleware": "^3.1.43-alpha.8",
30
32
  "winston": "^3.11.0",
31
33
  "winston-daily-rotate-file": "^5.0.0"
@@ -14,8 +14,8 @@ import { countDocumentsGroup, createGroupModel, findOneGroup } from '../service/
14
14
  // import { deleteOneAuthentication } from '../service/authentication.service.js';
15
15
  import { createBilling } from '../service/billing.service.js';
16
16
  import { createPaymentAccount } from '../service/paymentAccount.service.js';
17
- import { countDocumentsClusters } from '../service/cluster.service.js';
18
-
17
+ import { countDocumentsClusters, createclusterModel } from '../service/cluster.service.js';
18
+ import { countDocumentsTeams } from '../service/teams.service.js';
19
19
 
20
20
  export async function create( req, res ) {
21
21
  try {
@@ -81,17 +81,16 @@ export async function create( req, res ) {
81
81
  'auditConfigs.traxQueueName.cameraAngleChange': `${generatedName}-cameraAngleChange`,
82
82
  };
83
83
 
84
-
84
+ record.featureConfigs = {};
85
85
  if ( product && product.length > 0 ) {
86
86
  for ( let data of product ) {
87
- console.log( data.productName );
88
- record.featureConfigs = {};
87
+ record.featureConfigs.isNewDashboard = true;
88
+
89
89
  if ( data.productName === 'tangoTraffic' ) {
90
- record.featureConfigs.isNewDashboard = true;
91
90
  record.featureConfigs.isNewTraffic = true;
92
91
  record.featureConfigs.isNewReports = true;
93
92
  }
94
- if ( data.productName === 'tangozone' ) {
93
+ if ( data.productName === 'tangoZone' ) {
95
94
  record.featureConfigs.isNewZone = true;
96
95
  }
97
96
  if ( data.productName === 'tangoTrax' ) {
@@ -99,6 +98,8 @@ export async function create( req, res ) {
99
98
  }
100
99
  }
101
100
  }
101
+
102
+
102
103
  const insertClient = await insert( record );
103
104
 
104
105
  const insertedClientRecord = await findOneClient( { clientId: record.clientId }, {} );
@@ -130,6 +131,17 @@ export async function create( req, res ) {
130
131
 
131
132
  await createPaymentAccount( paymentAccount );
132
133
 
134
+ const defaultcluster = {
135
+ 'clusterName': 'All stores',
136
+ 'description': 'Contains all the onboarded stores',
137
+ 'stores': [],
138
+ 'Teamlead': [],
139
+ 'clientId': insertedClientRecord.clientId,
140
+ 'isDefaults': true,
141
+ };
142
+
143
+ await createclusterModel( defaultcluster );
144
+
133
145
 
134
146
  const defaultGroup = {
135
147
  'groupName': 'All stores',
@@ -660,7 +672,7 @@ export async function detailedAllClientCount( req, res ) {
660
672
  if ( result.length == 0 ) {
661
673
  return res.sendError( 'No Data Found', 204 );
662
674
  }
663
- result[0].activeStoresCount = activeStores.length - yettoInstallCount.length;
675
+ result[0].activeStoresCount = activeStores.length>0?( activeStores.length - yettoInstallCount.length ):0;
664
676
  result[0].activeCameraCount = activeCameras;
665
677
  return res.sendSuccess( { result: result } );
666
678
  } catch ( error ) {
@@ -1967,6 +1979,7 @@ export async function detailedClientCount( req, res ) {
1967
1979
  result['totalStoreCount'] = await countDocumentsStore( { clientId: inputData.clientId } );
1968
1980
  result['totalGroupCount'] = await countDocumentsGroup( { clientId: inputData.clientId, isActive: true } );
1969
1981
  result['totalclusterCount'] = await countDocumentsClusters( { clientId: inputData.clientId } );
1982
+ result['totalTeamsCount'] = await countDocumentsTeams( { clientId: inputData.clientId } );
1970
1983
  result['totalCameraCount'] = await countDocumentsCamera( { clientId: inputData.clientId } );
1971
1984
  result['totalUserCount'] = await countDocumentsUser( { clientId: inputData.clientId, userType: 'client' } );
1972
1985
 
@@ -0,0 +1,30 @@
1
+ import teamsModel from 'tango-api-schema/schema/teams.model.js';
2
+
3
+
4
+ export async function createTeamsModel( data ) {
5
+ return await teamsModel.create( data );
6
+ };
7
+ export async function updateOneTeams( query, record ) {
8
+ return await teamsModel.updateOne( query, { $set: record }, { upsert: true } );
9
+ };
10
+
11
+ export async function aggregateTeams( query ) {
12
+ return await teamsModel.aggregate( query );
13
+ };
14
+ export async function deleteTeams( query ={} ) {
15
+ return await teamsModel.deleteOne( query );
16
+ };
17
+
18
+ export async function findOneTeams( query ={}, field={} ) {
19
+ return await teamsModel.findOne( query, field );
20
+ };
21
+ export async function findteams( query ={}, field={} ) {
22
+ return await teamsModel.find( query, field );
23
+ };
24
+
25
+ export async function updateOneTeamModel( query, record ) {
26
+ return await teamsModel.updateOne( query, record );
27
+ }
28
+ export function countDocumentsTeams( query ) {
29
+ return teamsModel.countDocuments( query );
30
+ }