tango-app-api-store-builder 1.0.7 → 1.0.9

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.7",
3
+ "version": "1.0.9",
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.4.31",
35
+ "tango-api-schema": "^2.5.3",
36
36
  "tango-app-api-middleware": "3.1.48",
37
37
  "url": "^0.11.4",
38
38
  "winston": "^3.17.0",
@@ -3383,19 +3383,23 @@ export async function fixtureShelfProductv2( req, res ) {
3383
3383
 
3384
3384
 
3385
3385
  if ( req.body?.compliance ) {
3386
- let getAllFixtures = await fixtureShelfService.find( { planoId: fixture.planoId, floorId: fixture.floorId, fixtureId: { $ne: fixtureId } } );
3386
+ const [ getAllFixtures, getFixtureDetails ] = await Promise.all( [
3387
+ await fixtureShelfService.find( { planoId: fixture.planoId, floorId: fixture.floorId, fixtureId: { $ne: fixtureId } } ),
3388
+ await storeFixtureService.find( { planoId: fixture.planoId, floorId: fixture.floorId, fixtureId: { $ne: fixtureId } }, { _id: 1, fixtureName: 1 } ),
3389
+ ] );
3387
3390
 
3388
3391
  shelfMapping = getAllFixtures.reduce( ( acc, ele ) => {
3389
3392
  let productList = ele.productBrandName?.toString()?.toLowerCase();
3390
3393
  if ( !acc?.[productList] ) {
3391
3394
  let findZone = acc?.[productList]?.find( ( prod ) => prod.zone == ele.zone && prod.shelfId.toString() == ele._id.toString() );
3392
3395
  if ( !findZone ) {
3396
+ let fixDetails = getFixtureDetails.find( ( fix ) => fix._id.toString() == ele.fixtureId.toString() );
3393
3397
  acc[productList] = [
3394
3398
  {
3395
3399
  zone: ele.zone,
3396
3400
  shelfId: ele._id,
3397
3401
  fixtureId: ele.fixtureId,
3398
- fixtureName: fixture.fixtureName,
3402
+ fixtureName: fixDetails?.fixtureName,
3399
3403
  brandName: ele.productBrandName,
3400
3404
  },
3401
3405
  ];
@@ -3472,6 +3476,7 @@ export async function fixtureShelfProductv2( req, res ) {
3472
3476
  );
3473
3477
 
3474
3478
  let storageProducts = await planoMappingService.find( { fixtureId: new mongoose.Types.ObjectId( fixtureId ), type: 'storageBox' } );
3479
+ storageProducts = await getProducts( storageProducts );
3475
3480
  return res.sendSuccess( { ...fixture.toObject(), shelves: shelfProducts, vmConfig: vmDetails, productCount: productCount, storageProducts: storageProducts, fixtureImage: fixtureImage } );
3476
3481
  }
3477
3482
 
@@ -7630,7 +7635,7 @@ export async function getPlanogramList( req, res ) {
7630
7635
 
7631
7636
  const today = new Date( dayjs().format( 'YYYY-MM-DD' ) );
7632
7637
 
7633
- const storeQuery = { clientId,status:'active' };
7638
+ const storeQuery = { clientId, status: 'active' };
7634
7639
 
7635
7640
  if ( filter?.country?.length ) {
7636
7641
  storeQuery['storeProfile.country'] = { $in: filter.country };
@@ -7640,7 +7645,7 @@ export async function getPlanogramList( req, res ) {
7640
7645
  storeQuery['storeProfile.city'] = { $in: filter.city };
7641
7646
  }
7642
7647
 
7643
- const storeDocs = await storeService.find( storeQuery,{storeId:1,storeProfile:1} );
7648
+ const storeDocs = await storeService.find( storeQuery, { storeId: 1, storeProfile: 1 } );
7644
7649
 
7645
7650
  if ( !storeDocs.length ) {
7646
7651
  return res.sendSuccess( { data: [], count: 0 } );