tango-app-api-store-builder 1.0.0-beta-151 → 1.0.0-beta-153

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-151",
3
+ "version": "1.0.0-beta-153",
4
4
  "description": "storeBuilder",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1,7 +1,7 @@
1
1
  import * as floorService from '../service/storeBuilder.service.js';
2
2
  import { logger, insertOpenSearchData } from 'tango-app-api-middleware';
3
3
  // import * as storeService from '../service/store.service.js';
4
- // import * as planoService from '../service/planogram.service.js';
4
+ import * as planoService from '../service/planogram.service.js';
5
5
  import * as storeFixtureService from '../service/storeFixture.service.js';
6
6
  import * as fixtureShelfService from '../service/fixtureShelf.service.js';
7
7
  // import * as planoProductService from '../service/planoProduct.service.js';
@@ -519,6 +519,8 @@ export async function updateStorePlano( req, res ) {
519
519
  }
520
520
  } );
521
521
 
522
+ await planoService.updateOne( { _id: floorData.toObject().planoId }, { $set: { updatedAt: new Date() } } );
523
+
522
524
  res.sendSuccess( 'Updated Successfully' );
523
525
  } catch ( e ) {
524
526
  logger.error( { functionName: 'updateStorePlano', error: e } );
@@ -735,6 +737,13 @@ export async function updateStoreFixture( req, res ) {
735
737
  };
736
738
  }
737
739
 
740
+ if ( data.productResolutionLevel == 'L1' ) {
741
+ currentFixtureDoc.productBrandName = [ ...new Set( data.productBrandName.map( ( ele ) => ele ) ) ];
742
+ currentFixtureDoc.productCategory = [ ...new Set( data.productCategory.map( ( ele ) => ele ) ) ];
743
+ currentFixtureDoc.productSubCategory = [ ...new Set( data.productSubCategory.map( ( ele ) => ele ) ) ];
744
+ }
745
+
746
+
738
747
  delete currentFixtureDoc._id;
739
748
 
740
749
 
@@ -534,6 +534,20 @@ export async function updateStatus( req, res ) {
534
534
  if ( req.body.status == 'submit' ) {
535
535
  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' ) ) } } );
536
536
  }
537
+ let vmTask = await planoTaskService.find(
538
+ {
539
+ planoId: new mongoose.Types.ObjectId( taskDetails.planoId ),
540
+ floorId: new mongoose.Types.ObjectId( taskDetails.floorId ),
541
+ type: 'vm',
542
+ },
543
+
544
+ );
545
+ if ( vmTask.length>0 ) {
546
+ let allTaskDone = vmTask.filter( ( data ) => data.status === 'incomplete' );
547
+ if ( allTaskDone.length === 0 ) {
548
+ await floorService.updateOne( { _id: new mongoose.Types.ObjectId( taskDetails.floorId ) }, { planoProgress: 100 } );
549
+ }
550
+ }
537
551
  return res.sendSuccess( 'Task status updated successfully' );
538
552
  } catch ( e ) {
539
553
  logger.error( { functionName: 'storeLayout', error: e } );
@@ -632,20 +646,7 @@ export async function updateAnswersv2( req, res ) {
632
646
  }
633
647
 
634
648
  await insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).planotaskcompliances, data );
635
- let vmTask = await planoTaskService.find(
636
- {
637
- planoId: new mongoose.Types.ObjectId( req.body.planoId ),
638
- floorId: new mongoose.Types.ObjectId( req.body.floorId ),
639
- type: 'vm',
640
- },
641
649
 
642
- );
643
- if ( vmTask.length>0 ) {
644
- let allTaskDone = vmTask.filter( ( data ) => data.status === 'incomplete' );
645
- if ( allTaskDone.length === 0 ) {
646
- await floorService.updateOne( { _id: new mongoose.Types.ObjectId( req.body.floorId ) }, { planoProgress: 100 } );
647
- }
648
- }
649
650
  return res.sendSuccess( 'Fixture details updated successfully' );
650
651
  } catch ( e ) {
651
652
  logger.error( { functionName: 'updateAnswers', error: e } );