tango-app-api-client 3.3.2-beta.1 → 3.3.2-beta.2

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.1",
3
+ "version": "3.3.2-beta.2",
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.1.59",
28
+ "tango-api-schema": "^2.1.64",
29
29
  "tango-app-api-middleware": "^3.1.43-alpha.8",
30
30
  "winston": "^3.11.0",
31
31
  "winston-daily-rotate-file": "^5.0.0"
@@ -14,6 +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
19
 
18
20
 
19
21
  export async function create( req, res ) {
@@ -42,7 +44,7 @@ export async function create( req, res ) {
42
44
  const tangoId = count + 1;
43
45
  const generatedName = inputData.clientName.replace( /[^A-Z0-9]+/ig, '' );
44
46
  const product = leadRecord?.planDetails?.product.map( ( value ) => ( { productName: value } ) );
45
- const getPermission = await findOneStandaredRole( { roleName: 'superadmin', userType: 'client' }, { permission: 1 } );
47
+ const getPermission = await findOneStandaredRole( { roleName: 'superadmin', userType: 'client' }, { permission: 1, rolespermission: 1 } );
46
48
  const userQuery = {
47
49
  email: leadRecord?.corporateEmail,
48
50
  };
@@ -293,6 +295,7 @@ export async function create( req, res ) {
293
295
  userType: 'client',
294
296
  refreshToken: null,
295
297
  permission: getPermission?.permission,
298
+ rolespermission: getPermission?.rolespermission,
296
299
  clientId: String( tangoId ),
297
300
  };
298
301
  // await deleteOneAuthentication( { user: user?._id, type: 'retail' } );
@@ -1943,6 +1946,7 @@ export async function detailedClientCount( req, res ) {
1943
1946
  };
1944
1947
  result['totalStoreCount'] = await countDocumentsStore( { clientId: inputData.clientId } );
1945
1948
  result['totalGroupCount'] = await countDocumentsGroup( { clientId: inputData.clientId, isActive: true } );
1949
+ result['totalclusterCount'] = await countDocumentsClusters( { clientId: inputData.clientId } );
1946
1950
  result['totalCameraCount'] = await countDocumentsCamera( { clientId: inputData.clientId } );
1947
1951
  result['totalUserCount'] = await countDocumentsUser( { clientId: inputData.clientId, userType: 'client' } );
1948
1952
 
@@ -0,0 +1,27 @@
1
+ import clusterModel from 'tango-api-schema/schema/cluster.model.js';
2
+
3
+ export async function updateOneCluster( query, record ) {
4
+ return await clusterModel.updateOne( query, { $set: record } );
5
+ };
6
+
7
+ export async function updateCluster( query, record ) {
8
+ return await clusterModel.updateMany( query, record );
9
+ };
10
+
11
+ export async function aggregateCluster( query ) {
12
+ return await clusterModel.aggregate( query );
13
+ };
14
+
15
+ export async function findOneCluster( query ={}, field={} ) {
16
+ return await clusterModel.findOne( query, field );
17
+ };
18
+ export async function deleteCluster( query ={} ) {
19
+ return await clusterModel.deleteOne( query );
20
+ };
21
+
22
+ export async function createclusterModel( data ) {
23
+ return await clusterModel.create( data );
24
+ };
25
+ export function countDocumentsClusters( query ) {
26
+ return clusterModel.countDocuments( query );
27
+ }