tango-app-api-client 3.0.19-dev → 3.0.20-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.20-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
 
@@ -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
+ }