tango-app-api-task 3.2.0-beta.2 → 3.2.0-beta.3

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.0-beta.2",
3
+ "version": "3.2.0-beta.3",
4
4
  "description": "Task",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -972,6 +972,20 @@ export async function taskDetails( req, res ) {
972
972
  toDate.setUTCHours( 23, 59, 59, 59 );
973
973
  let limit = req.body?.limit || 10;
974
974
  let page = req.body?.offset ? ( req.body.offset * req.body.limit ) : 0;
975
+ let idList = [];
976
+ if ( ( req.body.checklistId && req.body.checklistId != '' ) || req.body.coverage.includes( 'checklist' ) ) {
977
+ let taskQuery;
978
+ if ( req.body.checklistId ) {
979
+ taskQuery = { referenceCheckListId: { $eq: req.body.checklistId } };
980
+ }
981
+ if ( req.body.coverage.includes( 'checklist' ) ) {
982
+ taskQuery = { referenceCheckListId: { $exists: true } };
983
+ }
984
+ let getChecklistDetails = await taskService.find( taskQuery, { _id: 1 } );
985
+ if ( getChecklistDetails ) {
986
+ idList = getChecklistDetails.map( ( item ) => item._id );
987
+ }
988
+ }
975
989
 
976
990
  let query = [
977
991
  {
@@ -979,6 +993,7 @@ export async function taskDetails( req, res ) {
979
993
  date_iso: { $gte: new Date( req.body.fromDate ), $lte: toDate },
980
994
  client_id: req.body.clientId,
981
995
  ...( req.body?.storeId?.length ) ? { store_id: { $in: req.body.storeId } } : {},
996
+ ...( idList.length ) ? { sourceCheckList_id: { $in: idList } } : {},
982
997
  },
983
998
  },
984
999
  { $sort: { date_iso: -1 } },