tango-app-api-task 3.7.20 → 3.7.21

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-task",
3
- "version": "3.7.20",
3
+ "version": "3.7.21",
4
4
  "description": "Task",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1704,7 +1704,7 @@ async function createUser( data ) {
1704
1704
  ],
1705
1705
  },
1706
1706
  {
1707
- featurName: 'TangoEye',
1707
+ featureName: 'TangoEye',
1708
1708
  modules: [
1709
1709
  {
1710
1710
  name: 'ZoneTag',
@@ -1715,7 +1715,7 @@ async function createUser( data ) {
1715
1715
  ],
1716
1716
  },
1717
1717
  {
1718
- featurName: 'TangoTrax',
1718
+ featureName: 'TangoTrax',
1719
1719
  modules: [
1720
1720
  {
1721
1721
  name: 'checklist',
@@ -1731,6 +1731,29 @@ async function createUser( data ) {
1731
1731
  },
1732
1732
  ],
1733
1733
  },
1734
+ {
1735
+ featureName: 'FootfallDirectory',
1736
+ modules: [
1737
+ {
1738
+ name: 'creator',
1739
+ isAdd: true,
1740
+ isEdit: true,
1741
+
1742
+ },
1743
+ {
1744
+ name: 'reviewer',
1745
+ isAdd: false,
1746
+ isEdit: false,
1747
+
1748
+ },
1749
+ {
1750
+ name: 'approver',
1751
+ isAdd: false,
1752
+ isEdit: false,
1753
+
1754
+ },
1755
+ ],
1756
+ },
1734
1757
  ],
1735
1758
  };
1736
1759
  let response = await userService.create( params );
@@ -5520,7 +5543,7 @@ export async function StoreHygienetask( req, res ) {
5520
5543
  }
5521
5544
  inputBody.taskDescription = '';
5522
5545
  let userId;
5523
- let storeDetails = await storeService.findOne( { storeName: inputBody.storeName, clientId: inputBody.clientId, status: 'active' }, { storeId: 1, storeName: 1, storeProfile: 1 } );
5546
+ let storeDetails = await storeService.findOne( { storeName: inputBody.storeName, clientId: inputBody.clientId, status: 'active' }, { storeId: 1, storeName: 1, storeProfile: 1, spocDetails: 1 } );
5524
5547
  if ( !storeDetails ) {
5525
5548
  return res.sendError( 'Store Not Found', 500 );
5526
5549
  }
@@ -5533,7 +5556,25 @@ export async function StoreHygienetask( req, res ) {
5533
5556
 
5534
5557
  let finduser = await checklistassignconfigModel.findOne( { checkListId: { $in: [ dailychecklistId, KSAchecklistId, UAEchecklistId, singaporechecklistId ] }, store_id: storeDetails.storeId } );
5535
5558
  if ( !finduser ) {
5536
- return res.sendError( 'No user Found For this store', 500 );
5559
+ finduser = await userService.findOne( { email: storeDetails?.spocDetails?.[0]?.email, clientId: inputBody.clientId }, { userId: '$_id', userName: 1, userEmail: '$email' } );
5560
+ if ( !finduser ) {
5561
+ finduser = await userService.findOne( { email: storeDetails?.spocDetails?.[0]?.email, clientId: { $ne: inputBody.clientId } }, { userId: '$_id', userName: 1, userEmail: '$email' } );
5562
+ if ( finduser ) {
5563
+ return res.sendError( 'UserEmail is mapped with another clientId', 400 );
5564
+ }
5565
+ let userData = {
5566
+ userName: storeDetails?.spocDetails?.[0]?.email.split( '@' )?.[0],
5567
+ email: storeDetails?.spocDetails?.[0]?.email,
5568
+ mobileNumber: '',
5569
+ clientId: inputBody.clientId,
5570
+ };
5571
+
5572
+ finduser = await createUser( userData );
5573
+ finduser.userId = finduser._id;
5574
+ finduser.userName = finduser.userName;
5575
+ finduser.userEmail = finduser.email;
5576
+ }
5577
+ // return res.sendError( 'No user Found For this store', 500 );
5537
5578
  }
5538
5579
 
5539
5580
  userId = finduser.userId;
@@ -5566,10 +5607,10 @@ export async function StoreHygienetask( req, res ) {
5566
5607
  let approverList = inputBody?.approver.split( ',' );
5567
5608
  let userAdmin = await userService.find( { clientId: inputBody.clientId, email: { $in: approverList }, userType: 'client', isActive: true }, { name: '$userName', email: 1 } );
5568
5609
  if ( userAdmin && userAdmin.length === 0 ) {
5569
- userAdmin = await userService.find( { clientId: inputBody.clientId, email: 'rohit.chawla@lenskart.com', userType: 'client', isActive: true }, { name: '$userName', email: 1 } );
5610
+ userAdmin = await userService.find( { clientId: inputBody.clientId, role: 'superadmin', userType: 'client', isActive: true }, { name: '$userName', email: 1 } );
5570
5611
  }
5571
5612
 
5572
- let creator = await userService.find( { clientId: inputBody.clientId, email: 'rohit.chawla@lenskart.com', userType: 'client', isActive: true } );
5613
+ let creator = await userService.find( { clientId: inputBody.clientId, role: 'superadmin', userType: 'client', isActive: true } );
5573
5614
  if ( creator && creator.length === 0 ) {
5574
5615
  return res.sendError( 'Invalid Creator Details', 500 );
5575
5616
  }
@@ -6044,19 +6085,19 @@ async function insertStoreHygienetaskSingleProcessedTask( checkTask, inputBody,
6044
6085
  newData.checkListType = 'task' || '';
6045
6086
  let insertprocessdata = await taskProcessedService.insert( newData );
6046
6087
  if ( insertprocessdata ) {
6047
- if ( response?.approver.length ) {
6048
- let inputData = [];
6049
- response?.approver.forEach( ( ele ) => {
6050
- inputData.push( {
6051
- userEmail: ele.email,
6052
- checkListId: response._id,
6053
- type: 'task',
6054
- client_id: inputBody.clientId,
6055
- checkListName: data?.checkListName || '',
6056
- } );
6057
- } );
6058
- await traxApprover.insertMany( inputData );
6059
- }
6088
+ // if ( response?.approver.length ) {
6089
+ // let inputData = [];
6090
+ // response?.approver.forEach( ( ele ) => {
6091
+ // inputData.push( {
6092
+ // userEmail: ele.email,
6093
+ // checkListId: response._id,
6094
+ // type: 'task',
6095
+ // client_id: inputBody.clientId,
6096
+ // checkListName: data?.checkListName || '',
6097
+ // } );
6098
+ // } );
6099
+ // await traxApprover.insertMany( inputData );
6100
+ // }
6060
6101
  return true;
6061
6102
  } else {
6062
6103
  return false;
@@ -6709,7 +6750,7 @@ export async function createAITaskGroup( req, res ) {
6709
6750
  ],
6710
6751
  },
6711
6752
  {
6712
- featurName: 'TangoEye',
6753
+ featureName: 'TangoEye',
6713
6754
  modules: [
6714
6755
  {
6715
6756
  name: 'ZoneTag',
@@ -6720,7 +6761,7 @@ export async function createAITaskGroup( req, res ) {
6720
6761
  ],
6721
6762
  },
6722
6763
  {
6723
- featurName: 'TangoTrax',
6764
+ featureName: 'TangoTrax',
6724
6765
  modules: [
6725
6766
  {
6726
6767
  name: 'checklist',
@@ -6736,6 +6777,29 @@ export async function createAITaskGroup( req, res ) {
6736
6777
  },
6737
6778
  ],
6738
6779
  },
6780
+ {
6781
+ featureName: 'FootfallDirectory',
6782
+ modules: [
6783
+ {
6784
+ name: 'creator',
6785
+ isAdd: true,
6786
+ isEdit: true,
6787
+
6788
+ },
6789
+ {
6790
+ name: 'reviewer',
6791
+ isAdd: false,
6792
+ isEdit: false,
6793
+
6794
+ },
6795
+ {
6796
+ name: 'approver',
6797
+ isAdd: false,
6798
+ isEdit: false,
6799
+
6800
+ },
6801
+ ],
6802
+ },
6739
6803
  ],
6740
6804
  };
6741
6805
  let response = await userService.create( params );