tango-app-api-client 3.0.8-dev → 3.0.8
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
|
@@ -15,10 +15,16 @@ export async function create( req, res ) {
|
|
|
15
15
|
const generatedName = inputData.clientName.replace( /[^A-Z0-9]+/ig, '' );
|
|
16
16
|
const product = leadRecord?.planDetails?.product.map( ( value ) => ( { productName: value } ) );
|
|
17
17
|
const getPermission = await findOneStandaredRole( { roleName: 'superadmin', userType: 'client' }, { permission: 1 } );
|
|
18
|
+
const userRecord = {
|
|
19
|
+
role: 'superadmin',
|
|
20
|
+
userType: 'client',
|
|
21
|
+
permission: getPermission?.permission,
|
|
22
|
+
};
|
|
18
23
|
const userQuery={
|
|
19
24
|
email: inputData?.corporateEmail,
|
|
20
25
|
};
|
|
21
|
-
const user = await
|
|
26
|
+
const user = await findOneAndUpdateUser( userQuery, userRecord );
|
|
27
|
+
logger.info( { message: user } );
|
|
22
28
|
const record = {
|
|
23
29
|
'clientName': leadRecord.clientName,
|
|
24
30
|
'clientId': String( tangoId ),
|
|
@@ -38,15 +44,6 @@ export async function create( req, res ) {
|
|
|
38
44
|
|
|
39
45
|
const insertClient = await insert( record );
|
|
40
46
|
if ( insertClient ) {
|
|
41
|
-
const userRecord = {
|
|
42
|
-
role: 'superadmin',
|
|
43
|
-
userType: 'client',
|
|
44
|
-
permission: getPermission?.permission,
|
|
45
|
-
clientId: String( tangoId ),
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
await findOneAndUpdateUser( userQuery, userRecord );
|
|
49
|
-
logger.info( { message: user } );
|
|
50
47
|
await createAuditQueue( generatedName );
|
|
51
48
|
return res.sendSuccess( { result: { clientId: String( tangoId ) } } );
|
|
52
49
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import userModel from 'tango-api-schema/schema/user.model.js';
|
|
2
2
|
|
|
3
|
-
export function findOneUser( query
|
|
4
|
-
return userModel.findOne( query
|
|
3
|
+
export function findOneUser( query ) {
|
|
4
|
+
return userModel.findOne( query );
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
export function countDocumentsUser( query ) {
|