tango-app-api-client 3.0.18-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.18-dev",
3
+ "version": "3.0.20-dev",
4
4
  "description": "client",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -26,7 +26,7 @@
26
26
  "nodemon": "^3.0.3",
27
27
  "swagger-ui-express": "^5.0.0",
28
28
  "tango-api-schema": "^2.0.65",
29
- "tango-app-api-middleware": "^1.0.49-dev",
29
+ "tango-app-api-middleware": "^1.0.51-dev",
30
30
  "winston": "^3.11.0",
31
31
  "winston-daily-rotate-file": "^5.0.0"
32
32
  },
@@ -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 {
@@ -33,8 +34,7 @@ export async function create( req, res ) {
33
34
  path: '/src/hbs/approved-client.hbs',
34
35
  subject: 'Your account has been verified by Tango!',
35
36
  };
36
- const mail = await sendEmail( data );
37
- logger.info( { message: mail, function: 'findOneUser' } );
37
+ await sendEmail( data );
38
38
  const record = {
39
39
  'clientName': leadRecord.clientName,
40
40
  'clientId': String( tangoId ),
@@ -77,7 +77,7 @@ export const sendEmail = ( data ) => {
77
77
  const subject = data.subject;
78
78
  const fileContent = readFileSync( join() + data.path, 'utf8' );
79
79
  const htmlContent = handlebars.compile( fileContent );
80
- const html = htmlContent();
80
+ const html = htmlContent( { url: appConfig.url.domain } );
81
81
  return sendEmailWithSES( data.email, subject, html, attachments, appConfig.cloud.aws.ses.adminEmail );
82
82
  } catch ( error ) {
83
83
  return error;
@@ -1015,10 +1015,10 @@ export async function detailedClientCount( req, res ) {
1015
1015
  const inputData = req.query;
1016
1016
  let result = {
1017
1017
  clientName: inputData.clientName,
1018
- role: 'admin',
1018
+ role: req?.user?.role,
1019
1019
  };
1020
1020
  result['totalStoreCount'] = await countDocumentsStore( { clientId: inputData.clientId } );
1021
- result['totalGroupCount'] = await countDocumentsStore( { clientId: inputData.clientId } );
1021
+ result['totalGroupCount'] = await countDocumentsGroup( { clientId: inputData.clientId } );
1022
1022
  result['totalCameraCount'] = await countDocumentsCamera( { clientId: inputData.clientId } );
1023
1023
  result['totalUserCount'] = await countDocumentsUser( { clientId: inputData.clientId, userType: 'client' } );
1024
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
+ }