tango-app-api-trax 3.3.1-beta-25 → 3.3.1-beta-27
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 +1 -1
- package/src/controllers/trax.controller.js +19 -84
- package/src/dtos/validation.dtos.js +4 -3
- package/src/hbs/login-otp.hbs +943 -943
package/package.json
CHANGED
|
@@ -548,7 +548,7 @@ async function createUser( data ) {
|
|
|
548
548
|
],
|
|
549
549
|
};
|
|
550
550
|
let response = await userService.create( params );
|
|
551
|
-
return response
|
|
551
|
+
return response;
|
|
552
552
|
} catch ( e ) {
|
|
553
553
|
logger.error( 'createUser =>', e );
|
|
554
554
|
return false;
|
|
@@ -2061,13 +2061,13 @@ export async function assignChecklistUser( req, res ) {
|
|
|
2061
2061
|
let inputBody = req.body;
|
|
2062
2062
|
let assignDetails = inputBody.assignUsers;
|
|
2063
2063
|
let newUsers = inputBody.newUsers;
|
|
2064
|
-
if ( inputBody.type == 'upload' ) {
|
|
2065
|
-
await assignedService.deleteMany( { checkListId: inputBody.checklistId } );
|
|
2066
|
-
}
|
|
2067
2064
|
let checklistDetails = await checklistService.findOne( { _id: inputBody.checklistId } );
|
|
2068
2065
|
if ( !checklistDetails ) {
|
|
2069
2066
|
return res.sendError( 'No data found', 204 );
|
|
2070
2067
|
}
|
|
2068
|
+
if ( inputBody.type == 'upload' ) {
|
|
2069
|
+
await assignedService.deleteMany( { checkListId: inputBody.checklistId } );
|
|
2070
|
+
}
|
|
2071
2071
|
await Promise.all( newUsers.map( async ( user ) => {
|
|
2072
2072
|
let getUser = inputBody.assignUsers.find( ( ele ) => ele.userEmail.toLowerCase() == user.toLowerCase() );
|
|
2073
2073
|
let userData = {
|
|
@@ -2078,15 +2078,15 @@ export async function assignChecklistUser( req, res ) {
|
|
|
2078
2078
|
};
|
|
2079
2079
|
await createUser( userData );
|
|
2080
2080
|
} ) );
|
|
2081
|
-
await Promise.all( assignDetails.map( async ( assign ) => {
|
|
2081
|
+
let assignData = await Promise.all( assignDetails.map( async ( assign ) => {
|
|
2082
2082
|
assign.checklistId = inputBody.checklistId;
|
|
2083
2083
|
assign.checkListName = checklistDetails.checkListName;
|
|
2084
2084
|
assign.coverage = inputBody.coverage;
|
|
2085
2085
|
assign.clientId = inputBody.clientId;
|
|
2086
2086
|
assign.upload = inputBody.type;
|
|
2087
|
-
await assignUsers( assign );
|
|
2087
|
+
return await assignUsers( assign );
|
|
2088
2088
|
} ) );
|
|
2089
|
-
return res.sendSuccess(
|
|
2089
|
+
return res.sendSuccess( { idList: assignData.map( ( item ) => item.assignId ), assignData } );
|
|
2090
2090
|
} catch ( e ) {
|
|
2091
2091
|
logger.error( { functionName: 'assignUser', error: e } );
|
|
2092
2092
|
return res.sendError( e, 500 );
|
|
@@ -3646,7 +3646,7 @@ async function assignUsers( data ) {
|
|
|
3646
3646
|
mobileNumber: storeDetails?.[0]?.spocDetails?.[0]?.phone,
|
|
3647
3647
|
clientId: data.clientId,
|
|
3648
3648
|
};
|
|
3649
|
-
userDetails = createUser( userData );
|
|
3649
|
+
userDetails = await createUser( userData );
|
|
3650
3650
|
}
|
|
3651
3651
|
assignedData = {
|
|
3652
3652
|
store_id: storeDetails?.[0]?.storeId,
|
|
@@ -3703,11 +3703,20 @@ async function assignUsers( data ) {
|
|
|
3703
3703
|
{
|
|
3704
3704
|
$match: {
|
|
3705
3705
|
clientId: data.clientId,
|
|
3706
|
-
...( !data?.upload ) ? { _id: new mongoose.Types.ObjectId( data.id ) } : { userEmail: data.
|
|
3706
|
+
...( !data?.upload ) ? { _id: new mongoose.Types.ObjectId( data.id ) } : { userEmail: data.userEmail.toLowerCase() },
|
|
3707
3707
|
},
|
|
3708
3708
|
},
|
|
3709
3709
|
];
|
|
3710
3710
|
let userDetails = await userService.aggregate( query );
|
|
3711
|
+
if ( !userDetails.length ) {
|
|
3712
|
+
let userData = {
|
|
3713
|
+
userName: data.userEmail.split( '@' )[0],
|
|
3714
|
+
email: data.userEmail,
|
|
3715
|
+
clientId: data.clientId,
|
|
3716
|
+
};
|
|
3717
|
+
let details = await createUser( userData );
|
|
3718
|
+
userDetails = [ details ];
|
|
3719
|
+
}
|
|
3711
3720
|
if ( userDetails.length ) {
|
|
3712
3721
|
assignedData = {
|
|
3713
3722
|
userId: userDetails?.[0]?._id,
|
|
@@ -3770,82 +3779,8 @@ export async function checklistAssign( req, res ) {
|
|
|
3770
3779
|
userName: store.spocDetails?.[0]?.name,
|
|
3771
3780
|
mobileNumber: store.spocDetails?.[0]?.phone || '',
|
|
3772
3781
|
email: store.spocDetails[0].email,
|
|
3773
|
-
password: '5dqFKAJj29PsV6P+kL+3Dw==',
|
|
3774
|
-
role: 'user',
|
|
3775
|
-
userType: 'client',
|
|
3776
|
-
rolespermission: [
|
|
3777
|
-
{
|
|
3778
|
-
featureName: 'Global',
|
|
3779
|
-
modules: [
|
|
3780
|
-
{
|
|
3781
|
-
name: 'Store',
|
|
3782
|
-
isAdd: false,
|
|
3783
|
-
isEdit: false,
|
|
3784
|
-
|
|
3785
|
-
},
|
|
3786
|
-
{
|
|
3787
|
-
name: 'User',
|
|
3788
|
-
isAdd: false,
|
|
3789
|
-
isEdit: false,
|
|
3790
|
-
|
|
3791
|
-
},
|
|
3792
|
-
{
|
|
3793
|
-
name: 'Camera',
|
|
3794
|
-
isAdd: false,
|
|
3795
|
-
isEdit: false,
|
|
3796
|
-
|
|
3797
|
-
},
|
|
3798
|
-
{
|
|
3799
|
-
name: 'Configuration',
|
|
3800
|
-
isAdd: false,
|
|
3801
|
-
isEdit: false,
|
|
3802
|
-
|
|
3803
|
-
},
|
|
3804
|
-
{
|
|
3805
|
-
name: 'Subscription',
|
|
3806
|
-
isAdd: false,
|
|
3807
|
-
isEdit: false,
|
|
3808
|
-
|
|
3809
|
-
},
|
|
3810
|
-
{
|
|
3811
|
-
name: 'Billing',
|
|
3812
|
-
isAdd: false,
|
|
3813
|
-
isEdit: false,
|
|
3814
|
-
|
|
3815
|
-
},
|
|
3816
|
-
],
|
|
3817
|
-
},
|
|
3818
|
-
{
|
|
3819
|
-
featurName: 'TangoEye',
|
|
3820
|
-
modules: [
|
|
3821
|
-
{
|
|
3822
|
-
name: 'ZoneTag',
|
|
3823
|
-
isAdd: false,
|
|
3824
|
-
isEdit: false,
|
|
3825
|
-
|
|
3826
|
-
},
|
|
3827
|
-
],
|
|
3828
|
-
},
|
|
3829
|
-
{
|
|
3830
|
-
featurName: 'TangoTrax',
|
|
3831
|
-
modules: [
|
|
3832
|
-
{
|
|
3833
|
-
name: 'checklist',
|
|
3834
|
-
isAdd: false,
|
|
3835
|
-
isEdit: false,
|
|
3836
|
-
|
|
3837
|
-
},
|
|
3838
|
-
{
|
|
3839
|
-
name: 'Task',
|
|
3840
|
-
isAdd: false,
|
|
3841
|
-
isEdit: false,
|
|
3842
|
-
|
|
3843
|
-
},
|
|
3844
|
-
],
|
|
3845
|
-
},
|
|
3846
|
-
],
|
|
3847
3782
|
};
|
|
3848
|
-
userDetails = await
|
|
3783
|
+
userDetails = await createUser( data );
|
|
3849
3784
|
}
|
|
3850
3785
|
let data = {
|
|
3851
3786
|
store_id: store.storeId,
|
|
@@ -81,9 +81,10 @@ export const checklistPageValidation = {
|
|
|
81
81
|
};
|
|
82
82
|
|
|
83
83
|
export const uploadUserSchema = joi.object( {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
84
|
+
id: joi.string().optional(),
|
|
85
|
+
checklistId: joi.string().optional(),
|
|
86
|
+
assignedUsers: joi.array().optional(),
|
|
87
|
+
uploadUser: joi.boolean().optional(),
|
|
87
88
|
type: joi.string().optional().allow( '' ),
|
|
88
89
|
addUser: joi.boolean().optional(),
|
|
89
90
|
delete: joi.boolean().optional(),
|