tango-app-api-task 3.2.1-beta-21 → 3.2.1-beta-22

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.2.1-beta-21",
3
+ "version": "3.2.1-beta-22",
4
4
  "description": "Task",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -264,8 +264,8 @@ export async function taskDetails( req, res ) {
264
264
  }
265
265
  if ( storechecklistdetails ) {
266
266
  result.checkListDetails = { ...storechecklistdetails._doc };
267
- let assignedusers = await taskAssignService.find( { checkListId: storechecklistdetails._id }, { _id: 1 } );
268
- assignedusers = assignedusers?.map( ( item ) => item._id );
267
+ let assignedusers = await taskAssignService.find( { checkListId: storechecklistdetails._id }, { assignId: 1 } );
268
+ assignedusers = assignedusers?.map( ( item ) => item.assignId );
269
269
  result.checkListDetails = { ...result.checkListDetails, ...{ sections: sectionList }, ...{ assignedusers: assignedusers } };
270
270
  }
271
271
  return res.sendSuccess( result );
@@ -664,12 +664,16 @@ export async function taskConfig( req, res ) {
664
664
  return res.sendError( { message: 'Task Id is Required' }, 400 );
665
665
  }
666
666
 
667
- if ( inputBody.submitType == 'publish' ) {
668
- let checkUserAssigned = await taskAssignService.findOne( { checkListId: inputBody._id, checkFlag: true } );
669
- if ( !checkUserAssigned ) {
670
- return res.sendError( { message: 'Please assign a user' }, 400 );
671
- }
667
+ if ( !inputBody.assignedUsers.length && inputBody.submitType == 'publish' ) {
668
+ return res.sendError( 'Please Assigned a user', 400 );
672
669
  }
670
+
671
+ // if ( inputBody.submitType == 'publish' ) {
672
+ // let checkUserAssigned = await taskAssignService.findOne( { checkListId: inputBody._id, checkFlag: true } );
673
+ // if ( !checkUserAssigned ) {
674
+ // return res.sendError( { message: 'Please assign a user' }, 400 );
675
+ // }
676
+ // }
673
677
  if ( !inputBody?.approver.length && inputBody.submitType == 'publish' ) {
674
678
  return res.sendError( { message: 'Please assign approver' }, 400 );
675
679
  }
@@ -1524,6 +1528,7 @@ export async function approveTask( req, res ) {
1524
1528
  sourceCheckList_id: req.body.sourceCheckList_id,
1525
1529
  fromDate: req.body.fromDate,
1526
1530
  toDate: req.body.toDate,
1531
+ filtertype: req.body.filtertype,
1527
1532
  store_id: inputstores,
1528
1533
  },
1529
1534
  'upsert': {
@@ -2644,6 +2649,7 @@ export async function StoreHygienetask( req, res ) {
2644
2649
  export async function eyeTesttask( req, res ) {
2645
2650
  try {
2646
2651
  let inputBody = req.body;
2652
+ console.log( inputBody );
2647
2653
  inputBody.clientId = 11;
2648
2654
  inputBody.taskDescription = '';
2649
2655
  let userId;
@@ -2654,7 +2660,9 @@ export async function eyeTesttask( req, res ) {
2654
2660
 
2655
2661
  let url = JSON.parse( process.env.LAMBDAURL );
2656
2662
  let checklistId = url.dailystoreChecklistId;
2663
+ console.log( checklistId );
2657
2664
  let finduser = await checklistassignconfigModel.findOne( { checkListId: new mongoose.Types.ObjectId( checklistId ), store_id: storeDetails.storeId } );
2665
+ console.log( finduser );
2658
2666
 
2659
2667
  if ( !finduser ) {
2660
2668
  return res.sendError( 'No user Found For this store', 500 );
@@ -2813,8 +2821,10 @@ export async function eyeTesttask( req, res ) {
2813
2821
  }
2814
2822
  question[0].questionReferenceImage = images;
2815
2823
  } else {
2824
+ console.log( req.file );
2816
2825
  let images = [];
2817
2826
  let uplaodedImage = await uploadmultiImage( req.files.referenceImage );
2827
+ console.log( uplaodedImage );
2818
2828
  let imgUrl = decodeURIComponent( uplaodedImage.imgUrl.split( '?' )[0] );
2819
2829
  let url = imgUrl.split( '/' );
2820
2830
  if ( url.includes( 'https:' ) || url.includes( 'http:' ) ) {
@@ -3440,7 +3450,6 @@ async function assignUsers( data ) {
3440
3450
  },
3441
3451
  ];
3442
3452
  let clusterDetails = await clusterServices.aggregateCluster( query );
3443
- console.log( clusterDetails );
3444
3453
  if ( clusterDetails.length ) {
3445
3454
  if ( !data.upload ) {
3446
3455
  assignedData = {