tango-app-api-trax 3.7.27 → 3.7.29

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.7.27",
3
+ "version": "3.7.29",
4
4
  "description": "Trax",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -4493,7 +4493,11 @@ export async function updateAssign( req, res ) {
4493
4493
  } else {
4494
4494
  removed = { user: [], store: [] };
4495
4495
  }
4496
-
4496
+ let storeProfileDetails;
4497
+ if ( req.body.coverage == 'store' ) {
4498
+ let storeList = req.body.assignedList.map( ( ele ) => ele?.storeId );
4499
+ storeProfileDetails = await storeService.find( { storeId: { $in: storeList } }, { storeId: 1, city: '$storeProfile.city', country: '$storeProfile.country' } );
4500
+ }
4497
4501
  await assignedService.deleteMany( { checkListId: req.body.checkListId } );
4498
4502
  let assignedUserList = [];
4499
4503
  let userEmailList = req.body.assignedList.map( ( ele ) => ele.userEmail.toLowerCase() );
@@ -4533,6 +4537,13 @@ export async function updateAssign( req, res ) {
4533
4537
  userId: userDetails?._id,
4534
4538
  checkListName: checklistDetails.checkListName,
4535
4539
  };
4540
+ if ( assign?.storeId ) {
4541
+ let findStore = storeProfileDetails.find( ( ele ) => ele.storeId == assign?.storeId )?.toObject();
4542
+ if ( findStore ) {
4543
+ data.city = findStore.city;
4544
+ data.country = findStore.country;
4545
+ }
4546
+ }
4536
4547
  delete data._id;
4537
4548
  assignedUserList.push( data );
4538
4549
  }