tango-app-api-store-builder 1.0.0-beta-115 → 1.0.0-beta-117

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-115",
3
+ "version": "1.0.0-beta-117",
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.2.153",
35
+ "tango-api-schema": "2.2.154",
36
36
  "tango-app-api-middleware": "^3.1.48",
37
37
  "url": "^0.11.4",
38
38
  "winston": "^3.17.0",
@@ -3129,11 +3129,20 @@ export async function storeFixturesTaskv2( req, res ) {
3129
3129
  };
3130
3130
  } ) );
3131
3131
 
3132
+ let disabled = true;
3133
+ if ( compliance?.status && compliance.status == 'incomplete' ) {
3134
+ let issueDetails = compliance?.answers?.[0]?.issues.find( ( ele ) => ele.status == 'disagree' );
3135
+ if ( issueDetails ) {
3136
+ disabled = false;
3137
+ }
3138
+ }
3139
+
3132
3140
  return {
3133
3141
  ...fixture.toObject(),
3134
3142
  status: compliance?.status ? compliance.status : '',
3135
3143
  shelfCount: shelves.shelves,
3136
3144
  productCount: productCount,
3145
+ disabled: disabled,
3137
3146
  vmCount: vmCount,
3138
3147
  shelfConfig: shelfDetails,
3139
3148
  vms: vmDetails,
@@ -3247,6 +3256,8 @@ export async function planoList( req, res ) {
3247
3256
  fixtureCapacity: '$fixtureDetails.fixtureCapacity',
3248
3257
  status: 1,
3249
3258
  planoProgress: 1,
3259
+ createdAt: 1,
3260
+ lastUpdate: '$updatedAt',
3250
3261
  },
3251
3262
  },
3252
3263
  ];
@@ -3272,7 +3283,6 @@ export async function planoList( req, res ) {
3272
3283
  ],
3273
3284
  },
3274
3285
  } );
3275
-
3276
3286
  let planoDetails = await planoService.aggregate( query );
3277
3287
 
3278
3288
  if ( !planoDetails[0].data.length ) {
@@ -458,8 +458,14 @@ export async function updateStatus( req, res ) {
458
458
  } else {
459
459
  currentDateTime = requestData?.currentTime ? dayjs( requestData.currentTime, 'HH:mm:ss' ) : dayjs();
460
460
  }
461
- let submitTimeString = currentDateTime.format( 'hh:mm A, DD MMM YYYY' );
462
- await processedService.updateOne( { _id: req.body.taskId }, { checklistStatus: req.body.status, ...( req.body.status == 'inprogress' ) ? { startTime_string: submitTimeString } : { submitTime_string: submitTimeString } } );
461
+ let timeString = currentDateTime.format( 'hh:mm A, DD MMM YYYY' );
462
+ let comments = {
463
+ userId: req.user._id,
464
+ userName: req.user.Name,
465
+ email: req.user.email,
466
+ comment: req.body.comments,
467
+ };
468
+ await processedService.updateOne( { _id: req.body.taskId }, { checklistStatus: req.body.status, ...( req.body.status == 'inprogress' ) ? { startTime_string: timeString } : { submitTime_string: timeString }, comments: { $push: comments } } );
463
469
  if ( req.body.status == 'submit' ) {
464
470
  await processedService.deleteMany( { planoId: taskDetails.planoId, userEmail: taskDetails.userEmail, store_id: taskDetails.store_id, ...( taskDetails?.floorId ) ? { floorId: taskDetails.floorId } : {}, date_iso: { $gt: new Date( dayjs().format( 'YYYY-MM-DD' ) ) } } );
465
471
  }
@@ -895,3 +901,20 @@ export async function taskSubmitDetails( req, res ) {
895
901
  return res.sendError( e, 500 );
896
902
  }
897
903
  }
904
+
905
+ export async function redoTask( req, res ) {
906
+ try {
907
+ if ( !req.body.taskId ) {
908
+ return res.sendError( 'Task id is required', 400 );
909
+ }
910
+ let getTaskDetails = await processedService.findOne( { _id: req.body.taskId } );
911
+ if ( !getTaskDetails ) {
912
+ return res.sendError( e, 204 );
913
+ }
914
+ await processedService.updateOne( { _id: req.body.taskId }, { checklistStatus: 'open', redoStatus: true } );
915
+ return res.sendSuccess( 'Task is republished successfully' );
916
+ } catch ( e ) {
917
+ logger.error( { functionName: 'redoTask', error: e } );
918
+ return res.sendError( e, 500 );
919
+ }
920
+ }
@@ -201,7 +201,7 @@ export const updateTaskConfig = {
201
201
  export const uploadBrandListSchema = joi.object( {
202
202
  clientId: joi.string().required(),
203
203
  brandData: joi.array().items( joi.any() ).min( 1 ).required(),
204
- brandUsedList:joi.array().items(joi.any()).min(0)
204
+ brandUsedList: joi.array().items( joi.any() ).min( 0 ),
205
205
  } );
206
206
 
207
207
  export const uploadBrandList = {
@@ -15,4 +15,5 @@ storeBuilderTaskRouter
15
15
  .get( '/getFixtureDetails', isAllowedSessionHandler, taskController.getFixtureDetails )
16
16
  .get( '/getVmDetails', isAllowedSessionHandler, taskController.getVmDetails )
17
17
  .post( '/generateTaskExcel', taskController.generatetaskDetails )
18
- .post( '/getSubmitDetails', taskController.taskSubmitDetails );
18
+ .post( '/getSubmitDetails', taskController.taskSubmitDetails )
19
+ .post( '/redoTask', isAllowedSessionHandler, taskController.redoTask );