tango-app-api-trax 3.3.1-beta-26 → 3.3.1-beta-28

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-trax",
3
- "version": "3.3.1-beta-26",
3
+ "version": "3.3.1-beta-28",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -548,7 +548,7 @@ async function createUser( data ) {
548
548
  ],
549
549
  };
550
550
  let response = await userService.create( params );
551
- return response._id;
551
+ return response;
552
552
  } catch ( e ) {
553
553
  logger.error( 'createUser =>', e );
554
554
  return false;
@@ -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.email.toLowerCase() },
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 userService.create( data );
3783
+ userDetails = await createUser( data );
3849
3784
  }
3850
3785
  let data = {
3851
3786
  store_id: store.storeId,
@@ -476,6 +476,7 @@ export const storePerformance = async ( req, res ) => {
476
476
  { checkListType: { $eq: 'custom' } },
477
477
  // { store_id: { $in: requestData.storeId } },
478
478
  { $or: [ { store_id: { $in: requestData.storeId } }, { store_id: { $eq: '' }, userEmail: { $in: getUserEmails } } ] },
479
+ { coverage: { $eq: 'store' } },
479
480
  );
480
481
 
481
482
  findQuery.push( { $match: { $and: findAndQuery } } );