tango-app-api-task 3.4.1-activitylog-11 → 3.4.1-activitylog-13

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-11",
3
+ "version": "3.4.1-activitylog-13",
4
4
  "description": "Task",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -25,7 +25,7 @@
25
25
  "mongodb": "^6.10.0",
26
26
  "nodemon": "^3.1.7",
27
27
  "npm": "^10.9.2",
28
- "tango-api-schema": "^2.2.106",
28
+ "tango-api-schema": "^2.2.108",
29
29
  "tango-app-api-middleware": "^3.1.58",
30
30
  "winston": "^3.17.0",
31
31
  "winston-daily-rotate-file": "^5.0.0"
@@ -1221,7 +1221,7 @@ function findObjectDifference( oldObj, newObj ) {
1221
1221
  }
1222
1222
 
1223
1223
 
1224
- export async function insertSingleProcessData( checklistId,answerTypechange,inputBody ) {
1224
+ export async function insertSingleProcessData( checklistId, answerTypechange, inputBody ) {
1225
1225
  try {
1226
1226
  let currentdate = new Date();
1227
1227
  let date = dayjs( currentdate ).format();
@@ -1333,7 +1333,7 @@ export async function insertSingleProcessData( checklistId,answerTypechange,inpu
1333
1333
  updatedchecklist = checklistDetails;
1334
1334
  }
1335
1335
  if ( updatedchecklist ) {
1336
- await insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, dateVal, startTimeIso, endTimeIso, insertdata,answerTypechange,inputBody );
1336
+ await insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, dateVal, startTimeIso, endTimeIso, insertdata, answerTypechange, inputBody );
1337
1337
  }
1338
1338
  }
1339
1339
  }
@@ -1345,7 +1345,7 @@ export async function insertSingleProcessData( checklistId,answerTypechange,inpu
1345
1345
  }
1346
1346
  };
1347
1347
 
1348
- async function insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, date, startTimeIso, endTimeIso, insertdata,answerTypechange ) {
1348
+ async function insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, date, startTimeIso, endTimeIso, insertdata, answerTypechange, inputBody ) {
1349
1349
  let getquestionQuery = [];
1350
1350
 
1351
1351
  if ( dayjs( getCLconfig.publishDate ).format( 'YYYY-MM-DD' ) != dayjs( date ).format( 'YYYY-MM-DD' ) ) {
@@ -1513,11 +1513,11 @@ async function insertPCBulkV3( getCLconfig, checklistId, updatedchecklist, date,
1513
1513
  element4.remainder = getCLconfig?.remainder || [];
1514
1514
  element4.restrictAttendance = getCLconfig?.restrictAttendance;
1515
1515
  element4.coverage = getCLconfig?.coverage;
1516
- if(inputBody&&inputBody?.streamId){
1516
+ if ( inputBody&&inputBody?.streamId ) {
1517
1517
  element4.streamId = inputBody?.streamId;
1518
1518
  }
1519
- if(answerTypechange){
1520
- element4.planotype = "qrScan"
1519
+ if ( answerTypechange ) {
1520
+ element4.planotype = 'qrScan';
1521
1521
  }
1522
1522
  element4.coverage = getCLconfig?.coverage;
1523
1523
  assignUserList.push( element4 );
@@ -3830,7 +3830,7 @@ export async function eyeTesttask( req, res ) {
3830
3830
  userId: userId,
3831
3831
  };
3832
3832
  await taskAssignService.create( userDetails );
3833
- await insertSingleProcessData( response?._id,true,inputBody);
3833
+ await insertSingleProcessData( response?._id, true, inputBody );
3834
3834
  return res.sendSuccess( 'Task created successfully' );
3835
3835
  }
3836
3836
  } catch ( e ) {
@@ -4320,7 +4320,7 @@ async function assignUsers( data ) {
4320
4320
  userName: store.spocDetails?.[0]?.name,
4321
4321
  userEmail: store.spocDetails?.[0]?.email,
4322
4322
  clusterName: clusterDetails?.[0]?.clusterName,
4323
- id: clusterDetails?.[0]?._id,
4323
+ id: [ clusterDetails?.[0]?._id ],
4324
4324
  };
4325
4325
  return userData;
4326
4326
  } ) );
@@ -4335,7 +4335,7 @@ async function assignUsers( data ) {
4335
4335
  userName: user.userName,
4336
4336
  userEmail: user.email,
4337
4337
  teamName: teamDetails?.[0]?.teamName,
4338
- id: teamDetails?.[0]?._id,
4338
+ id: [ teamDetails?.[0]?._id ],
4339
4339
  };
4340
4340
  return userData;
4341
4341
  } );
@@ -4403,6 +4403,7 @@ export async function taskAssign( req, res ) {
4403
4403
  uniqueArr = uniqueArr.reduce( ( acc, obj ) => {
4404
4404
  if ( acc[obj.storeName] ) {
4405
4405
  acc[obj.storeName].clusterName += ',' + obj.clusterName;
4406
+ acc[obj.storeName].id.push( ...obj.id );
4406
4407
  } else {
4407
4408
  acc[obj.storeName] = { ...obj };
4408
4409
  }
@@ -4414,6 +4415,7 @@ export async function taskAssign( req, res ) {
4414
4415
  uniqueArr = uniqueArr.reduce( ( acc, obj ) => {
4415
4416
  if ( acc[obj.userEmail] ) {
4416
4417
  acc[obj.userEmail].teamName += ','+ obj.teamName;
4418
+ acc[obj.userEmail].id.push( ...obj.id );
4417
4419
  } else {
4418
4420
  acc[obj.userEmail] = { ...obj };
4419
4421
  }
@@ -4439,15 +4441,24 @@ export async function updateAssign( req, res ) {
4439
4441
  if ( !taskDetails ) {
4440
4442
  return res.sendError( 'No data found', 204 );
4441
4443
  }
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
- }, [] );
4444
+ let groupList = [];
4445
+ let groupAssignList = req.body.assignedGroup;
4446
+ req.body.assignedGroup = [ ...new Set( req.body.assignedGroup.flatMap( ( item ) => item.id ) ) ];
4447
+
4448
+ groupAssignList.forEach( ( ele ) => {
4449
+ let gName;
4450
+ if ( ele?.clusterName ) {
4451
+ gName = ele.clusterName.split( ',' );
4452
+ }
4453
+ if ( ele?.teamName ) {
4454
+ gName = ele.teamName.split( ',' );
4455
+ }
4456
+ gName.forEach( ( name ) => {
4457
+ if ( !groupList.includes( name ) ) {
4458
+ groupList.push( name );
4459
+ }
4460
+ } );
4461
+ } );
4451
4462
  // req.body.assignedGroup = req.body.assignedGroup.map( ( ele ) => {
4452
4463
  // return { id: ele };
4453
4464
  // } );