tango-app-api-store-builder 1.0.0-beta-213 → 1.0.0-beta-215

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-213",
3
+ "version": "1.0.0-beta-215",
4
4
  "description": "storeBuilder",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -979,7 +979,7 @@ export async function updateFixtureStatus( req, res ) {
979
979
  { 'ans._id': new mongoose.Types.ObjectId( req.body.answerId ) },
980
980
  ] );
981
981
 
982
- await planoTaskService.updateOne( { _id: req.body._id }, { approvalStatus: 'approved' } );
982
+ await planoTaskService.updateOne( { _id: req.body._id }, { approvalStatus: 'approved', taskType: 'initial' } );
983
983
  let fixtureTask = await planoTaskService.find(
984
984
  {
985
985
  planoId: new mongoose.Types.ObjectId( req.body.planoId ),
@@ -1224,16 +1224,26 @@ export async function updateStoreFixture( req, res ) {
1224
1224
  try {
1225
1225
  const { fixtureId, data } = req.body;
1226
1226
 
1227
+ let configId;
1228
+
1227
1229
  const currentFixture = await storeFixtureService.findOne( { _id: new mongoose.Types.ObjectId( fixtureId ) } );
1228
1230
  let currentFixtureDoc = currentFixture.toObject();
1229
1231
  if ( req?.body?.taskType?.includes( 'fixture' ) || data?.taskType?.includes( 'fixture' ) ) {
1230
1232
  let shelfDetails = await fixtureShelfService.find( { fixtureId: fixtureId } );
1231
1233
  data.shelfConfig.forEach( ( ele ) => {
1232
1234
  let findShelfProduct = shelfDetails.find( ( shelf ) => shelf.shelfNumber == ele.shelfNumber );
1233
- ele.productBrandName = findShelfProduct?.productBrandName ?? [];
1234
- ele.productCategory = findShelfProduct?.productCategory ?? [];
1235
- ele.productSubCategory = findShelfProduct?.productSubCategory ?? [];
1236
- ele.zone = findShelfProduct?.zone ?? 'Bottom';
1235
+ if ( !ele?.zone ) {
1236
+ ele.zone = findShelfProduct?.zone ?? 'Bottom';
1237
+ }
1238
+ if ( !ele?.productBrandName ) {
1239
+ ele.productBrandName = findShelfProduct?.productBrandName ?? [];
1240
+ }
1241
+ if ( !ele?.productCategory ) {
1242
+ ele.productCategory = findShelfProduct?.productCategory ?? [];
1243
+ }
1244
+ if ( !ele?.productSubCategory ) {
1245
+ ele.productSubCategory = findShelfProduct?.productSubCategory ?? [];
1246
+ }
1237
1247
  } );
1238
1248
  let vmConfig = [];
1239
1249
  for ( let vm of data.vmConfig ) {
@@ -1356,9 +1366,14 @@ export async function updateStoreFixture( req, res ) {
1356
1366
  templateData.templateType = 'sub';
1357
1367
  templateData.masterTemplateId = fixtureMasterTemplate._id;
1358
1368
  let subTemplate = await fixtureConfigService.create( templateData );
1369
+ configId = subTemplate._id;
1370
+
1371
+ console.log( subTemplate, 'subTemplate' );
1359
1372
 
1360
1373
  data.fixtureConfigId = subTemplate._id;
1361
1374
  data.masterTemplateId = fixtureMasterTemplate._id;
1375
+ } else {
1376
+ data.fixtureConfigId = fixturesubTemplate?.[0]?._id;
1362
1377
  }
1363
1378
  }
1364
1379
 
@@ -1464,7 +1479,10 @@ export async function updateStoreFixture( req, res ) {
1464
1479
  },
1465
1480
  );
1466
1481
  }
1467
- res.sendSuccess( 'Updated Successfully' );
1482
+ if ( req.body?.editMode ) {
1483
+ await floorService.updateOne( { _id: new mongoose.Types.ObjectId( currentFixture.floorId ) }, { isEdited: true } );
1484
+ }
1485
+ res.sendSuccess( { message: 'Updated Successfully', ...( configId && { id: configId } ) } );
1468
1486
  } catch ( e ) {
1469
1487
  logger.error( { functionName: 'updateStoreFixture', error: e } );
1470
1488
  return res.sendError( e, 500 );
@@ -3552,7 +3552,7 @@ export async function storeFixturesTaskv2( req, res ) {
3552
3552
  let disabled = true;
3553
3553
  if ( compliance?.status ) {
3554
3554
  const hasDisagree = compliance?.answers?.some( ( answer ) =>
3555
- answer?.status === 'disagree' || ( req.body?.type == 'fixture' && req?.body?.redo && compliance.status == 'complete' && !answer?.status ) ||
3555
+ answer?.status === 'disagree' ||
3556
3556
  answer?.issues?.some( ( issue ) =>
3557
3557
  issue?.Details?.some( ( detail ) => detail.status === 'disagree' ),
3558
3558
  ),
@@ -3655,7 +3655,7 @@ export async function storeFixturesTaskv2( req, res ) {
3655
3655
  let disabled = true;
3656
3656
  if ( compliance?.status ) {
3657
3657
  const hasDisagree = compliance?.answers?.some( ( answer ) =>
3658
- answer?.status === 'disagree' || ( req.body?.type == 'fixture' && req?.body?.redo && compliance.status == 'complete' && !answer?.status ) ||
3658
+ answer?.status === 'disagree' ||
3659
3659
  answer?.issues?.some( ( issue ) =>
3660
3660
  issue?.Details?.some( ( detail ) => detail.status === 'disagree' ),
3661
3661
  ),
@@ -4606,7 +4606,7 @@ export async function planoList( req, res ) {
4606
4606
  } );
4607
4607
  }
4608
4608
  if ( inputData.filter.status.includes( 'completed' ) ) {
4609
- let taskType= [ 'layout', 'fixture', 'vm' ];
4609
+ let taskType= [ 'fixture' ];
4610
4610
  let andCondition = [];
4611
4611
  taskType.forEach( ( type ) => {
4612
4612
  andCondition.push(
@@ -4617,7 +4617,7 @@ export async function planoList( req, res ) {
4617
4617
  },
4618
4618
  } },
4619
4619
  {
4620
- [`taskDetails.${type}Status`]: '',
4620
+ [`taskDetails.${type}Status`]: 'complete',
4621
4621
  },
4622
4622
  );
4623
4623
  } );
@@ -4890,6 +4890,7 @@ export async function getTaskDetails( req, res ) {
4890
4890
  floorId: '$_id.floorId',
4891
4891
  redoStatus: '$redoStatus',
4892
4892
  endTime: '$scheduleEndTime_iso',
4893
+ taskId: '$taskId',
4893
4894
  breach: {
4894
4895
  $cond: {
4895
4896
  if: {
@@ -5274,6 +5275,7 @@ export async function getTaskDetails( req, res ) {
5274
5275
  redoStatus: '$$task.redoStatus',
5275
5276
  endTime: '$$task.endTime',
5276
5277
  breach: '$$task.breach',
5278
+ taskId: '$$task.taskId',
5277
5279
  feedbackStatus: {
5278
5280
  $switch: {
5279
5281
  branches: [
@@ -5304,7 +5306,7 @@ export async function getTaskDetails( req, res ) {
5304
5306
  let taskInfo = await planotaskService.aggregate( query );
5305
5307
  let disabledInfo = [];
5306
5308
  let floorDetails = await layoutService.findOne( { _id: req.query.floorId }, { isEdited: 1, planoProgress: 1 } );
5307
- disabledInfo = taskInfo?.[0]?.taskStatus?.filter( ( ele ) => ( ( ele.feedbackStatus && ![ 'complete', 'disagree' ].includes( ele.feedbackStatus ) ) || ele.status != 'submit' ) && !ele?.breach );
5309
+ disabledInfo = taskInfo?.[0]?.taskStatus?.filter( ( ele ) => ( ele.feedbackStatus && ![ 'complete', 'disagree' ].includes( ele.feedbackStatus ) && ele.status == 'submit' ) || ( ele.status != 'submit' && !ele?.breach ) );
5308
5310
  if ( floorDetails.isEdited ) {
5309
5311
  let findPending = taskInfo?.[0]?.taskStatus?.findIndex( ( ele ) => ele.type == 'fixture' && ele.feedbackStatus == 'pending' );
5310
5312
  if ( findPending != -1 ) {
@@ -1113,7 +1113,7 @@ export async function revokeTask( req, res ) {
1113
1113
  if ( !req.body.floorId ) {
1114
1114
  return res.sendError( 'floor id is required', 400 );
1115
1115
  }
1116
- await processedService.deleteMany( { planoId: req.body.planoId, floorId: req.body.floorId, checklistStatus: { $ne: 'submit' }, ...( req.body?.type && { planoType: req.body?.type } ) } );
1116
+ await processedService.deleteMany( { planoId: req.body.planoId, floorId: req.body.floorId, ...( req.body?.type != 'fixture' && { checklistStatus: { $ne: 'submit' } } ), ...( req.body?.type && { planoType: req.body?.type } ) } );
1117
1117
  return res.sendSuccess( 'Task revoked successfully' );
1118
1118
  } catch ( e ) {
1119
1119
  logger.error( { functionName: 'revokeTask', error: e } );