tango-app-api-store-builder 1.0.0-beta-180 → 1.0.0-beta-182

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-180",
3
+ "version": "1.0.0-beta-182",
4
4
  "description": "storeBuilder",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -32,7 +32,7 @@
32
32
  "path": "^0.12.7",
33
33
  "selenium-webdriver": "^4.31.0",
34
34
  "sharp": "^0.34.1",
35
- "tango-api-schema": "^2.3.12",
35
+ "tango-api-schema": "^2.3.19",
36
36
  "tango-app-api-middleware": "3.1.48",
37
37
  "url": "^0.11.4",
38
38
  "winston": "^3.17.0",
@@ -152,12 +152,13 @@ export async function getTemplateDetails( req, res ) {
152
152
  return vm;
153
153
  }
154
154
  } ) );
155
+ templateDetails.status = templateDetails.status == 'draft' ? 'draft' : 'inactive';
155
156
  let storeFixtureDetails = await storeFixtureService.find( { fixtureConfigId: req.query.templateId } );
156
157
  if ( storeFixtureDetails.length ) {
157
158
  let fixtureId = storeFixtureDetails.map( ( ele ) => ele.planoId );
158
159
  let planoDetails = await planoService.find( { _id: { $in: fixtureId } }, { status: 1 } );
159
160
  planoDetails = planoDetails.map( ( ele ) => ele.status );
160
- templateDetails.status = planoDetails.includes( 'completed' ) ? 'active' : 'inactive';
161
+ templateDetails.status = planoDetails.includes( 'completed' ) ? 'active' : templateDetails.status;
161
162
  }
162
163
  let data = {
163
164
  ...templateDetails,
@@ -922,6 +922,7 @@ export async function updateGlobalComment( req, res ) {
922
922
  floorId: new mongoose.Types.ObjectId( req.body.floorId ),
923
923
  taskType: req.body.taskType,
924
924
  clientId: req.body.clientId,
925
+ taskId: req.body.taskId,
925
926
  };
926
927
  await planoGlobalCommentService.create( payload );
927
928
  await insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).planoglobalcomments, payload );
@@ -1143,6 +1144,31 @@ function pipelineStage( type, planoId, floorId, filterByStatus, filterByApproval
1143
1144
  },
1144
1145
  };
1145
1146
 
1147
+ let commandLookup = {
1148
+ $lookup: {
1149
+ from: 'planoglobalcomments',
1150
+ let: { taskId: '$_id' },
1151
+ pipeline: [
1152
+ {
1153
+ $match: {
1154
+ $expr: {
1155
+ $eq: [ '$taskId', '$$taskId' ],
1156
+ },
1157
+ },
1158
+ },
1159
+
1160
+ ],
1161
+ as: 'commentData',
1162
+ },
1163
+ };
1164
+
1165
+ let unwindCommenTask = {
1166
+ $unwind: {
1167
+ path: '$commentData',
1168
+ preserveNullAndEmptyArrays: true,
1169
+ },
1170
+ };
1171
+
1146
1172
 
1147
1173
  const commonLookups = type === 'layout' ? [] : [
1148
1174
  {
@@ -1287,6 +1313,7 @@ function pipelineStage( type, planoId, floorId, filterByStatus, filterByApproval
1287
1313
  ],
1288
1314
  },
1289
1315
  },
1316
+ 'comments': { $first: '$commentData' },
1290
1317
  },
1291
1318
  },
1292
1319
  ];
@@ -1294,6 +1321,8 @@ function pipelineStage( type, planoId, floorId, filterByStatus, filterByApproval
1294
1321
  ...matchStage,
1295
1322
  taskLookup,
1296
1323
  unwindTask,
1324
+ commandLookup,
1325
+ unwindCommenTask,
1297
1326
  ...commonLookups,
1298
1327
  ...vmStages,
1299
1328
  ...finalGrouping,
@@ -135,6 +135,7 @@ export async function createTask( req, res ) {
135
135
  scheduleEndTime_iso: dayjs.utc( scheduleEndTime, 'hh:mm A' ).format(),
136
136
  date_string: dayjs().format( 'YYYY-MM-DD' ),
137
137
  date_iso: new Date( dayjs().format( 'YYYY-MM-DD' ) ),
138
+ refTaskId: req.body.taskId,
138
139
  },
139
140
  };
140
141
 
@@ -151,6 +152,7 @@ export async function createTask( req, res ) {
151
152
  // if ( !taskDetails.length ) {
152
153
  // return res.sendError( 'No data found', 204 );
153
154
  // }
155
+ let response;
154
156
  let userDetails;
155
157
  let storeList;
156
158
  let endDate;
@@ -342,13 +344,13 @@ export async function createTask( req, res ) {
342
344
  // let currDate = dayjs().add( j, 'days' );
343
345
  // let time = j ? '12:00 AM' : currDate.format( 'hh:mm A' );
344
346
  let insertData = { ...taskData };
345
- await processedService.updateOne( { store_id: insertData.store_id, userEmail: insertData.userEmail, planoId: insertData.planoId, planoType: taskData.planoType, ...( taskData?.floorId ) ? { floorId: taskData.floorId }:{}, ...( [ 'merchRollout', 'vmRollout' ].includes( taskData.planoType ) && { sourceCheckList_id: taskData.sourceCheckList_id } ) }, insertData );
347
+ response = await processedService.updateOne( { store_id: insertData.store_id, userEmail: insertData.userEmail, planoId: insertData.planoId, planoType: taskData.planoType, ...( taskData?.floorId ) ? { floorId: taskData.floorId }:{}, ...( [ 'merchRollout', 'vmRollout' ].includes( taskData.planoType ) && { sourceCheckList_id: taskData.sourceCheckList_id } ) }, insertData );
346
348
  // }
347
349
  }
348
350
  }
349
351
  } ) );
350
352
  // } ) );
351
- return res.sendSuccess( 'Task created successfully' );
353
+ return res.sendSuccess( { message: 'Task created successfully', taskId: response?.upsertedId } );
352
354
  }
353
355
  } catch ( e ) {
354
356
  console.log( e );