tango-app-api-store-builder 1.0.0-beta-202 → 1.0.0-beta-203

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-202",
3
+ "version": "1.0.0-beta-203",
4
4
  "description": "storeBuilder",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1473,12 +1473,6 @@ export async function getTreeList( req, res ) {
1473
1473
  ...( req.query?.masterId ) ? { masterTemplateId: new ObjectId( req.query.masterId ) } :{ clientId: req.query.clientId, templateType: 'master' },
1474
1474
  },
1475
1475
  },
1476
- {
1477
- $sort: {
1478
- 'header.label': 1,
1479
- },
1480
- },
1481
-
1482
1476
  ];
1483
1477
 
1484
1478
  let fixtureDetails = await fixtureConfigService.aggregate( query );
@@ -2717,9 +2717,9 @@ export async function qrScan1( req, res ) {
2717
2717
  const fm = await getFixtureMetrics( fixture, currentDate );
2718
2718
 
2719
2719
 
2720
- return res.sendSuccess( { data: productMapping, fixtureMetrics: fm, status: 'proper' } );
2720
+ return res.sendSuccess( { data: { ...productMapping.toObject() }, fixtureMetrics: fm, status: 'proper' } );
2721
2721
  } else if ( fixture.productResolutionLevel === 'L3' ) {
2722
- const sectionShelves = await fixtureShelfService.find( { fixtureId: fixture._id, zone: req.body.sectionName } );
2722
+ const sectionShelves = await fixtureShelfService.find( { fixtureId: fixture._id, sectionName: req.body.sectionName } );
2723
2723
 
2724
2724
  if ( !sectionShelves.length ) return res.sendError( 'No shelves found for the Section', 400 );
2725
2725
 
@@ -2744,7 +2744,7 @@ export async function qrScan1( req, res ) {
2744
2744
  const fm = await getFixtureMetrics( fixture, currentDate );
2745
2745
 
2746
2746
 
2747
- return res.sendSuccess( { data: locatePlano, fixtureMetrics: fm, status: 'misplaced' } );
2747
+ return res.sendSuccess( { data: { ...locatePlano.toObject() }, fixtureMetrics: fm, status: 'misplaced' } );
2748
2748
  }
2749
2749
 
2750
2750
  planoMapping.forEach( async ( ele ) => {
@@ -5568,17 +5568,3 @@ export async function getRolloutTaskDetails( req, res ) {
5568
5568
  return res.sendError( e, 500 );
5569
5569
  }
5570
5570
  }
5571
-
5572
- export async function getPlanoStoreList( req, res ) {
5573
- try {
5574
- let storeDetails = await storeService.find( { status: 'active', clientId: req.query.clientId }, { storeId: 1 } );
5575
- if ( !storeDetails.length ) {
5576
- return res.sendError( 'No data found', 204 );
5577
- }
5578
- let planoDetails = await planoService.find( { storeId: { $in: storeDetails.map( ( ele ) => ele.storeId ) } }, { _id: 1, storeName: 1, storeId: 1 } );
5579
- return res.sendSuccess( planoDetails );
5580
- } catch ( e ) {
5581
- logger.error( { functionName: 'getPlanoStoreList', error: e } );
5582
- return res.sendError( e, 500 );
5583
- }
5584
- }
@@ -15,7 +15,8 @@ import * as floorService from '../service/storeBuilder.service.js';
15
15
  import * as planoStaticService from '../service/planoStaticData.service.js';
16
16
  import * as assignService from '../service/assignService.service.js';
17
17
  import * as storeBuilderService from '../service/storeBuilder.service.js';
18
- // import * as storeFixtureService from '../service/storeFixture.service.js';
18
+ import * as storeFixtureService from '../service/storeFixture.service.js';
19
+ import * as fixtureShelfService from '../service/fixtureShelf.service.js';
19
20
 
20
21
 
21
22
  dayjs.extend( timeZone );
@@ -676,8 +677,6 @@ export async function updateAnswersv2( req, res ) {
676
677
  if ( !taskDetails ) {
677
678
  return res.sendError( 'No data found', 204 );
678
679
  }
679
- console.log( req.body.answers[0] );
680
- console.log( req.body.answers[0].issues[0] );
681
680
  let data = {
682
681
  fixtureId: req.body.fixtureId,
683
682
  answers: req.body.answers,
@@ -692,8 +691,6 @@ export async function updateAnswersv2( req, res ) {
692
691
  storeId: req.body?.storeId,
693
692
  date_string: dayjs().format( 'YYYY-MM-DD' ),
694
693
  };
695
- console.log( '111111', data.answers[0] );
696
- console.log( '111111', data.answers[0].issues[0] );
697
694
  if ( req.body.type === 'layout' ) {
698
695
  await planoTaskService.updateOne( { planoId: req.body.planoId, taskType: req.body.taskType, floorId: req.body.floorId, fixtureId: req.body.fixtureId, type: req.body.type, ...( taskDetails?._id ) ? { taskId: taskDetails?._id } : {} }, data );
699
696
  } else {
@@ -713,6 +710,35 @@ export async function updateAnswersv2( req, res ) {
713
710
  await sendMessageToQueue( `${sqs.url}${sqs.storeBuilder}`, JSON.stringify( sqsData ) );
714
711
  }
715
712
 
713
+ if ( req.body.type === 'fixture' ) {
714
+ let fixtureData = await storeFixtureService.findOne( { _id: new mongoose.Types.ObjectId( req.body.fixtureId ) } );
715
+
716
+ if ( fixtureData ) {
717
+ fixtureData = fixtureData?.toObject();
718
+
719
+ let fixtureShelves = await fixtureShelfService.find( { fixtureId: fixtureData._id } );
720
+
721
+ if ( fixtureShelves.length ) {
722
+ fixtureShelves = fixtureShelves.map( ( shelf ) => shelf?.toObject() );
723
+
724
+ fixtureData.shelfConfig = fixtureShelves;
725
+ }
726
+ }
727
+
728
+ let sqsData = {
729
+ bucket: JSON.parse( process.env.BUCKET ).storeBuilder,
730
+ date_string: dayjs().format( 'YYYY-MM-DD' ),
731
+ storeName: data?.storeName,
732
+ imagePath: data?.answers[0]?.image,
733
+ fixtureId: req.body.fixtureId,
734
+ fixtureData: fixtureData,
735
+ };
736
+
737
+ const sqs = JSON.parse( process.env.SQS );
738
+ await sendMessageToQueue( `${sqs.url}${sqs.fixtureImageProcess}`, JSON.stringify( sqsData ) );
739
+ }
740
+
741
+
716
742
  return res.sendSuccess( 'Fixture details updated successfully' );
717
743
  } catch ( e ) {
718
744
  logger.error( { functionName: 'updateAnswers', error: e } );
@@ -54,5 +54,4 @@ storeBuilderRouter
54
54
  .get( '/taskDetails', isAllowedSessionHandler, storeBuilderController.getTaskDetails )
55
55
  .get( '/getPlanoUser', isAllowedSessionHandler, storeBuilderController.getPlanoUser )
56
56
  .post( '/planoRolloutList', isAllowedSessionHandler, storeBuilderController.getRolloutDetails )
57
- .get( '/getRolloutTaskDetails', isAllowedSessionHandler, storeBuilderController.getRolloutTaskDetails )
58
- .get( '/getPlanoStoreList', isAllowedSessionHandler, storeBuilderController.getPlanoStoreList );
57
+ .get( '/getRolloutTaskDetails', isAllowedSessionHandler, storeBuilderController.getRolloutTaskDetails );