tango-app-api-store-builder 1.0.0-beta-142 → 1.0.0-beta-143

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-store-builder",
3
- "version": "1.0.0-beta-142",
3
+ "version": "1.0.0-beta-143",
4
4
  "description": "storeBuilder",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -26,7 +26,7 @@ export async function getplanoFeedback( req, res ) {
26
26
  console.log( taskTypes );
27
27
  await Promise.all(
28
28
  taskTypes.map( async ( type, index ) => {
29
- const pipeline = buildPipelineByType( type, req.body.planoId, req.body.floorId, filterByStatus, filterByApprovalStatus );
29
+ const pipeline = buildPipelineByType( type, req.body.planoId, req.body.floorId, filterByStatus, filterByApprovalStatus, req.body.showtask );
30
30
 
31
31
  const data = await planoTaskService.aggregate( pipeline );
32
32
  console.log( '-------', data );
@@ -56,7 +56,7 @@ export async function getplanoFeedback( req, res ) {
56
56
  return res.sendError( e, 500 );
57
57
  }
58
58
  }
59
- function buildPipelineByType( type, planoId, floorId, filterByStatus, filterByApprovalStatus ) {
59
+ function buildPipelineByType( type, planoId, floorId, filterByStatus, filterByApprovalStatus, showtask ) {
60
60
  console.log( type, planoId, floorId, filterByStatus );
61
61
  const matchStage = {
62
62
  $match: {
@@ -67,7 +67,7 @@ function buildPipelineByType( type, planoId, floorId, filterByStatus, filterByAp
67
67
  },
68
68
  };
69
69
 
70
- const taskLookup = {
70
+ let taskLookup = {
71
71
  $lookup: {
72
72
  from: 'processedtasks',
73
73
  let: { taskId: '$taskId' },
@@ -104,6 +104,34 @@ function buildPipelineByType( type, planoId, floorId, filterByStatus, filterByAp
104
104
  as: 'taskData',
105
105
  },
106
106
  };
107
+ if ( showtask ) {
108
+ taskLookup = {
109
+ $lookup: {
110
+ from: 'processedtasks',
111
+ let: { taskId: '$taskId' },
112
+ pipeline: [
113
+ {
114
+ $match: {
115
+ $expr: {
116
+ $and: [
117
+ { $eq: [ '$_id', '$$taskId' ] },
118
+ ],
119
+ },
120
+ },
121
+ },
122
+ {
123
+ $project: {
124
+ userName: 1,
125
+ createdAt: 1,
126
+ createdByName: 1,
127
+ submitTime_string: 1,
128
+ },
129
+ },
130
+ ],
131
+ as: 'taskData',
132
+ },
133
+ };
134
+ }
107
135
 
108
136
  const unwindTask = { $unwind: { path: '$taskData', preserveNullAndEmptyArrays: false } };
109
137