tango-app-api-task 3.4.1-activitylog-12 → 3.4.1-activitylog-14

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.4.1-activitylog-12",
3
+ "version": "3.4.1-activitylog-14",
4
4
  "description": "Task",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -2330,7 +2330,6 @@ export async function approveTask( req, res ) {
2330
2330
  let url = JSON.parse( process.env.LAMBDAURL );
2331
2331
 
2332
2332
  let searchResponse = await fetch( url.approveTask, requestOptions );
2333
- console.log( 'logData', logData );
2334
2333
  let logData= {
2335
2334
  'client_id': taskDetails[0].client_id,
2336
2335
  'createAt': new Date(),
@@ -4320,7 +4319,7 @@ async function assignUsers( data ) {
4320
4319
  userName: store.spocDetails?.[0]?.name,
4321
4320
  userEmail: store.spocDetails?.[0]?.email,
4322
4321
  clusterName: clusterDetails?.[0]?.clusterName,
4323
- id: clusterDetails?.[0]?._id,
4322
+ id: [ clusterDetails?.[0]?._id ],
4324
4323
  };
4325
4324
  return userData;
4326
4325
  } ) );
@@ -4335,7 +4334,7 @@ async function assignUsers( data ) {
4335
4334
  userName: user.userName,
4336
4335
  userEmail: user.email,
4337
4336
  teamName: teamDetails?.[0]?.teamName,
4338
- id: teamDetails?.[0]?._id,
4337
+ id: [ teamDetails?.[0]?._id ],
4339
4338
  };
4340
4339
  return userData;
4341
4340
  } );
@@ -4403,6 +4402,7 @@ export async function taskAssign( req, res ) {
4403
4402
  uniqueArr = uniqueArr.reduce( ( acc, obj ) => {
4404
4403
  if ( acc[obj.storeName] ) {
4405
4404
  acc[obj.storeName].clusterName += ',' + obj.clusterName;
4405
+ acc[obj.storeName].id.push( ...obj.id );
4406
4406
  } else {
4407
4407
  acc[obj.storeName] = { ...obj };
4408
4408
  }
@@ -4414,6 +4414,7 @@ export async function taskAssign( req, res ) {
4414
4414
  uniqueArr = uniqueArr.reduce( ( acc, obj ) => {
4415
4415
  if ( acc[obj.userEmail] ) {
4416
4416
  acc[obj.userEmail].teamName += ','+ obj.teamName;
4417
+ acc[obj.userEmail].id.push( ...obj.id );
4417
4418
  } else {
4418
4419
  acc[obj.userEmail] = { ...obj };
4419
4420
  }
@@ -4439,15 +4440,24 @@ export async function updateAssign( req, res ) {
4439
4440
  if ( !taskDetails ) {
4440
4441
  return res.sendError( 'No data found', 204 );
4441
4442
  }
4442
- let groupList = req.body.assignedGroup;
4443
- req.body.assignedGroup = [ ...new Set( req.body.assignedGroup.map( ( item ) => item.id ) ) ];
4444
- groupList = req.body.assignedGroup.reduce( ( acc, ele ) => {
4445
- let findDetails = groupList.find( ( item ) => item.id == ele );
4446
- if ( findDetails ) {
4447
- acc.push( findDetails?.clusterName || findDetails?.teamName );
4448
- };
4449
- return acc;
4450
- }, [] );
4443
+ let groupList = [];
4444
+ let groupAssignList = req.body.assignedGroup;
4445
+ req.body.assignedGroup = [ ...new Set( req.body.assignedGroup.flatMap( ( item ) => item.id ) ) ];
4446
+
4447
+ groupAssignList.forEach( ( ele ) => {
4448
+ let gName;
4449
+ if ( ele?.clusterName ) {
4450
+ gName = ele.clusterName.split( ',' );
4451
+ }
4452
+ if ( ele?.teamName ) {
4453
+ gName = ele.teamName.split( ',' );
4454
+ }
4455
+ gName.forEach( ( name ) => {
4456
+ if ( !groupList.includes( name ) ) {
4457
+ groupList.push( name );
4458
+ }
4459
+ } );
4460
+ } );
4451
4461
  // req.body.assignedGroup = req.body.assignedGroup.map( ( ele ) => {
4452
4462
  // return { id: ele };
4453
4463
  // } );