tango-app-api-client 3.0.19-dev → 3.0.21-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.19-dev",
3
+ "version": "3.0.21-dev",
4
4
  "description": "client",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -11,6 +11,7 @@ import { deleteOneAuthentication } from '../service/authentication.service.js';
11
11
  import { join } from 'path';
12
12
  import { readFileSync } from 'fs';
13
13
  import handlebars from 'handlebars';
14
+ import { countDocumentsGroup } from '../service/group.service.js';
14
15
 
15
16
  export async function create( req, res ) {
16
17
  try {
@@ -1014,10 +1015,10 @@ export async function detailedClientCount( req, res ) {
1014
1015
  const inputData = req.query;
1015
1016
  let result = {
1016
1017
  clientName: inputData.clientName,
1017
- role: 'admin',
1018
+ role: req?.user?.role,
1018
1019
  };
1019
1020
  result['totalStoreCount'] = await countDocumentsStore( { clientId: inputData.clientId } );
1020
- result['totalGroupCount'] = await countDocumentsStore( { clientId: inputData.clientId } );
1021
+ result['totalGroupCount'] = await countDocumentsGroup( { clientId: inputData.clientId } );
1021
1022
  result['totalCameraCount'] = await countDocumentsCamera( { clientId: inputData.clientId } );
1022
1023
  result['totalUserCount'] = await countDocumentsUser( { clientId: inputData.clientId, userType: 'client' } );
1023
1024
 
@@ -473,7 +473,7 @@ export const clientDocs = {
473
473
  },
474
474
  },
475
475
  },
476
- '/v3/user/client-list': {
476
+ '/v3/client/client-list': {
477
477
  get: {
478
478
  tags: [ 'Client' ],
479
479
  description: `Get list of client Info`,
@@ -495,7 +495,7 @@ export const clientDocs = {
495
495
  },
496
496
  },
497
497
 
498
- '/v3/user/detailed-client-count': {
498
+ '/v3/client/detailed-client-count': {
499
499
  get: {
500
500
  tags: [ 'Client' ],
501
501
  description: `Get a client overall Info`,
@@ -0,0 +1,5 @@
1
+ import groupModel from 'tango-api-schema/schema/group.model.js';
2
+
3
+ export function countDocumentsGroup( query ) {
4
+ return groupModel.countDocuments( query );
5
+ }