tango-app-api-client 3.0.4 → 3.0.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.0.4",
3
+ "version": "3.0.5",
4
4
  "description": "client",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -5,7 +5,6 @@ import { aggregateStore, countDocumentsStore } from '../service/store.service.js
5
5
  import { aggregateCamera, countDocumentsCamera } from '../service/camera.service.js';
6
6
  import _ from 'lodash';
7
7
  import { findOneStandaredRole } from '../service/standaredRole.service.js';
8
- import { createUserPermission } from '../service/userPermission.service.js';
9
8
 
10
9
  export async function create( req, res ) {
11
10
  try {
@@ -16,6 +15,7 @@ export async function create( req, res ) {
16
15
  const generatedName =inputData.clientName.replace( /[^A-Z0-9]+/ig, '' );
17
16
  const product = leadRecord?.planDetails?.product.map( ( value ) => ( { productName: value } ) );
18
17
  const password = await encrypt( leadRecord?.mobileNumber.toString() );
18
+ const getPermission = await findOneStandaredRole( { roleName: 'superadmin', clientType: 'client' }, { permission: 1 } );
19
19
  const userRecord ={
20
20
  userName: leadRecord?.lastName?`${inputData.firstName}${inputData.lastName}`: inputData?.firstName,
21
21
  email: leadRecord?.corporateEmail,
@@ -23,17 +23,9 @@ export async function create( req, res ) {
23
23
  mobileNumber: leadRecord?.mobileNumber,
24
24
  role: 'superadmin',
25
25
  userType: 'client',
26
- };
27
- const user = await createUser( userRecord );
28
- const getPermission = await findOneStandaredRole( { roleName: 'superadmin', clientType: 'client' }, { permission: 1 } );
29
- const permissionRecord ={
30
- userName: user?.userName,
31
- email: user?.email,
32
- role: user?.role,
33
- userType: user?.userType,
34
26
  permission: getPermission?.permission,
35
27
  };
36
- await createUserPermission( permissionRecord );
28
+ const user = await createUser( userRecord );
37
29
  const record = {
38
30
  'clientName': leadRecord.clientName,
39
31
  'clientId': String( tangoId ),
@@ -1,5 +0,0 @@
1
- import userPermissionModel from 'tango-api-schema/schema/userPermission.model.js';
2
-
3
- export async function createUserPermission( record ) {
4
- return userPermissionModel.create( record );
5
- }