tango-app-api-store-builder 1.0.0-beta-63 → 1.0.0-beta-65

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-63",
3
+ "version": "1.0.0-beta-65",
4
4
  "description": "storeBuilder",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -23,7 +23,7 @@
23
23
  "joi": "^17.13.3",
24
24
  "mongodb": "^6.12.0",
25
25
  "nodemon": "^3.1.9",
26
- "tango-api-schema": "^2.2.73",
26
+ "tango-api-schema": "^2.2.75",
27
27
  "tango-app-api-middleware": "^3.1.48",
28
28
  "winston": "^3.17.0",
29
29
  "winston-daily-rotate-file": "^5.0.0",
@@ -13,7 +13,7 @@ import * as planoMappingService from '../service/planoMapping.service.js';
13
13
  // import * as planoQrConversionRequestService from '../service/planoQrConversionRequest.service.js';
14
14
  import * as fixtureConfigService from '../service/fixtureConfig.service.js';
15
15
  import mongoose from 'mongoose';
16
-
16
+ import model from 'tango-api-schema';
17
17
 
18
18
  export async function getStoreNames( req, res ) {
19
19
  try {
@@ -151,9 +151,9 @@ export async function createPlano( req, res ) {
151
151
  scanType: 'qr',
152
152
  };
153
153
 
154
- await planoService.create( planoInsertData );
155
-
156
154
  console.log( planoInsertData );
155
+
156
+ await planoService.create( planoInsertData );
157
157
  }
158
158
 
159
159
  return res.sendSuccess( { message: 'Plano data inserted successfully', length: storeNamesArray.length } );
@@ -1753,3 +1753,92 @@ export async function updateRfidProduct2( req, res ) {
1753
1753
  return res.sendError( e.message || 'Internal Server Error', 500 );
1754
1754
  }
1755
1755
  }
1756
+
1757
+ export async function getProdTaskData( req, res ) {
1758
+ try {
1759
+ if ( req?.headers?.authorization?.split( ' ' )[1] !== 'hwjXfCD6TgMvc82cuSGZ9bNv9MuXsaiQ6uvx' ) {
1760
+ return res.sendError( 'Unauthorized', 401 );
1761
+ }
1762
+
1763
+ const db = mongoose.createConnection( 'mongodb+srv://tango-api-production:5TdxKKSkZiRVtjta@production.qc4rw.mongodb.net/tango-retail?authSource=admin', {
1764
+ useNewUrlParser: true,
1765
+ useUnifiedTopology: true,
1766
+ } );
1767
+
1768
+ const planoModel = db.model( 'planogram', model.planogramModel.schema );
1769
+
1770
+ const planoData = await planoModel.findOne( { storeName: req.body.store } );
1771
+
1772
+ const planoTaskModel = db.model( 'planotaskcompliance', model.planoTaskCompliance.schema );
1773
+
1774
+ let fixtureDetails = await planoTaskModel.find( { planoId: planoData.toObject()._id, type: req.body.type } );
1775
+ if ( !fixtureDetails ) {
1776
+ return res.sendError( 'No data found', 204 );
1777
+ }
1778
+
1779
+ // for ( let i = 0; i < fixtureDetails.length; i++ ) {
1780
+ // const data = await Promise.all( fixtureDetails?.[i].answers.map( async ( ans ) => {
1781
+ // if ( ans?.correctedFixture?.length ) {
1782
+ // for ( let fixture of ans.correctedFixture ) {
1783
+ // if ( fixture.image ) {
1784
+ // let params = {
1785
+ // Bucket: JSON.parse( process.env.BUCKET ).storeBuilder,
1786
+ // file_path: fixture.image,
1787
+ // };
1788
+ // fixture.image = await signedUrl( params );
1789
+ // }
1790
+ // if ( fixture.video ) {
1791
+ // let params = {
1792
+ // Bucket: JSON.parse( process.env.BUCKET ).storeBuilder,
1793
+ // file_path: fixture.video,
1794
+ // };
1795
+ // fixture.video = await signedUrl( params );
1796
+ // }
1797
+ // }
1798
+ // }
1799
+ // if ( ans?.newVms?.length ) {
1800
+ // for ( let fixture of ans.newVms ) {
1801
+ // if ( fixture.imageUrl ) {
1802
+ // let params = {
1803
+ // Bucket: JSON.parse( process.env.BUCKET ).storeBuilder,
1804
+ // file_path: fixture.imageUrl,
1805
+ // };
1806
+ // fixture.imageUrl = await signedUrl( params );
1807
+ // }
1808
+ // if ( fixture.video ) {
1809
+ // let params = {
1810
+ // Bucket: JSON.parse( process.env.BUCKET ).storeBuilder,
1811
+ // file_path: fixture.video,
1812
+ // };
1813
+ // fixture.video = await signedUrl( params );
1814
+ // }
1815
+ // }
1816
+ // }
1817
+ // if ( ans.image ) {
1818
+ // let params = {
1819
+ // Bucket: JSON.parse( process.env.BUCKET ).storeBuilder,
1820
+ // file_path: ans.image,
1821
+ // };
1822
+ // let imageUrl = await signedUrl( params );
1823
+ // ans.image = imageUrl;
1824
+ // }
1825
+ // if ( ans.video ) {
1826
+ // let params = {
1827
+ // Bucket: JSON.parse( process.env.BUCKET ).storeBuilder,
1828
+ // file_path: ans.video,
1829
+ // };
1830
+ // let imageUrl = await signedUrl( params );
1831
+ // ans.video = imageUrl;
1832
+ // }
1833
+ // return ans;
1834
+ // } ) );
1835
+ // fixtureDetails[i].answers = data;
1836
+ // }
1837
+
1838
+
1839
+ return res.sendSuccess( fixtureDetails );
1840
+ } catch ( e ) {
1841
+ logger.error( { functionName: 'getProdTaskData', error: e } );
1842
+ return res.sendError( e.message || 'Internal Server Error', 500 );
1843
+ }
1844
+ }
@@ -14,6 +14,8 @@ import * as planoComplianceService from '../service/planoCompliance.service.js';
14
14
  import * as planoTaskComplianceService from '../service/planoTask.service.js';
15
15
  import * as planoQrConversionRequestService from '../service/planoQrConversionRequest.service.js';
16
16
  import * as fixtureConfigService from '../service/fixtureConfig.service.js';
17
+ import * as planoStaticBrandCategoriesService from '../service/planoStaticBrandCategories.service.js';
18
+
17
19
 
18
20
  import path from 'path';
19
21
 
@@ -2543,7 +2545,12 @@ export const getShelfSections = async ( req, res ) => {
2543
2545
 
2544
2546
  const [ data ] = sections;
2545
2547
 
2546
- return res.sendSuccess( data?.sectionNames );
2548
+ const resData = [
2549
+ ...data?.sectionNames,
2550
+ 'NA',
2551
+ ];
2552
+
2553
+ return res.sendSuccess( resData );
2547
2554
  } catch ( error ) {
2548
2555
  logger.error( 'getShelfSections =>', error );
2549
2556
  return res.sendError( 'Internal Server Error', 500 );
@@ -2712,132 +2719,9 @@ export const getFixtureBrands = async ( req, res ) => {
2712
2719
 
2713
2720
  // const [ data ] = sections;
2714
2721
 
2715
- const data = [
2716
- 'Acuvue',
2717
- 'Acuvue Moist',
2718
- 'Acuvue Oasys',
2719
- 'Acuvue Vita',
2720
- 'Air Optix',
2721
- 'Alcon',
2722
- 'Alcon Air Optix',
2723
- 'Alcon Aquacomfort',
2724
- 'Alcon Focus',
2725
- 'Alcon Freshlook',
2726
- 'Alcon O2 Optix',
2727
- 'Alcon Precision',
2728
- 'Alcon Total',
2729
- 'All Clean',
2730
- 'Amara',
2731
- 'Amara Color',
2732
- 'Aqua Clear',
2733
- 'Aqua Lens 10H Dailies',
2734
- 'Aqua Soft',
2735
- 'Aquacolor',
2736
- 'Aquacolor Candypack',
2737
- 'Aquacolor Premium',
2738
- 'Aquacolor_Dailies 10LP',
2739
- 'Aquacolor_Monthly 2LP',
2740
- 'Aquacolor_Premium 2LP',
2741
- 'Aqualens',
2742
- 'Aqualens Nxt',
2743
- 'Aqualens_24H 30LP',
2744
- 'Aqualens_24H 6LP',
2745
- 'Aqualens_24H Nxt 3LP',
2746
- 'Aqualens_CandyPack 2LP',
2747
- 'Aqualens_Dailies 10LP',
2748
- 'Aqualens_Dailies 30LP',
2749
- 'Aqualens_Dailies 5LP',
2750
- 'Bausch & Lomb',
2751
- 'Bausch & Lomb Lacelle',
2752
- 'Bausch & Lomb PureVision',
2753
- 'Bausch & Lomb Soflens',
2754
- 'Bausch & Lomb Soflens 59',
2755
- 'Bausch & Lomb iConnect',
2756
- 'Bella',
2757
- 'Biomedic',
2758
- 'Biotrue',
2759
- 'Boss Orange',
2760
- 'British Optics',
2761
- 'Calvin Klein',
2762
- 'Carrera',
2763
- 'Celebration Toric',
2764
- 'Chamelo',
2765
- 'Chhota Bheem',
2766
- 'Ciba Vision',
2767
- 'Clalen Iris',
2768
- 'Colour Perfection',
2769
- 'Cooper Vision',
2770
- 'Cooper Vision Avaira',
2771
- 'Cooper Vision Biofinity',
2772
- 'Diva',
2773
- 'FORM',
2774
- 'Fallon Colby',
2775
- 'Fastrack',
2776
- 'Fossil',
2777
- 'French Connection',
2778
- 'Freshlook',
2779
- 'Hooper',
2780
- 'Hooper Online',
2781
- 'Hooper Screen Glasses',
2782
- 'ICE CUBE',
2783
- 'IDEE',
2784
- 'J&J Define',
2785
- 'John Jacobs',
2786
- 'John Jacobs Computer Glasses',
2787
- 'John Jacobs Online',
2788
- 'John Jacobs Screen Glasses',
2789
- 'John Jacobs TI',
2790
- 'Johnson & Johnson',
2791
- 'LENSKART BLU READERS',
2792
- 'LENSKART PREMIUM READERS',
2793
- 'Le Petit Lunetier',
2794
- 'Lee Cooper',
2795
- 'Lenses Only',
2796
- 'Lenskart',
2797
- 'Lenskart Air',
2798
- 'Lenskart Air LA',
2799
- 'Lenskart Air Online',
2800
- 'Lenskart Air Screen Glasses',
2801
- 'Lenskart BLU Screen Glasses',
2802
- 'Lenskart Boost',
2803
- 'Lenskart Hustlr',
2804
- 'Lenskart Hustlr Screen Glasses',
2805
- 'Lenskart Junior Computer Glasses',
2806
- 'Lenskart PLUS',
2807
- 'Lenskart READERS',
2808
- 'Lenskart STUDIO',
2809
- 'Lenskart Safety Goggles',
2810
- 'Lenskart Studio Online',
2811
- 'Lenskart TOI Special',
2812
- 'Lensme',
2813
- 'Lensspray',
2814
- 'Lewis Hamilton',
2815
- 'Mask',
2816
- 'New Balance',
2817
- 'OJOS',
2818
- 'OWNDAYS',
2819
- 'Oakley',
2820
- 'Opti-Free',
2821
- 'Other Third Party Brands',
2822
- 'Polaroid',
2823
- 'Ray-Ban',
2824
- 'Sunpocket',
2825
- 'Superman',
2826
- 'ThinOptics',
2827
- 'Tom and Jerry',
2828
- 'Tommy Hilfiger',
2829
- 'Velocity',
2830
- 'Vincent Chase',
2831
- 'Vincent Chase Essentials',
2832
- 'Vincent Chase Kids',
2833
- 'Vincent Chase Online',
2834
- 'Vincent Chase Polarized',
2835
- 'Vincent Chase Screen Glasses',
2836
- 'Vintage',
2837
- 'Vogue',
2838
- ];
2722
+ const brandCategories = await planoStaticBrandCategoriesService.findOne( { } );
2839
2723
 
2840
- return res.sendSuccess( data );
2724
+ return res.sendSuccess( brandCategories.toObject().data );
2841
2725
  } catch ( error ) {
2842
2726
  logger.error( 'getFixtureBrands =>', error );
2843
2727
  return res.sendError( 'Internal Server Error', 500 );
@@ -15,4 +15,5 @@ scriptRouter
15
15
  .post( '/lk98lK1993Update', scriptController.lk98lK1993Update )
16
16
  .post( '/updateinventory', scriptController.updateInventory )
17
17
  .post( '/updateRfidProduct', scriptController.updateRfidProduct )
18
- .post( '/updateRfidProduct2', scriptController.updateRfidProduct2 );
18
+ .post( '/updateRfidProduct2', scriptController.updateRfidProduct2 )
19
+ .post('/getProdTaskData', scriptController.getProdTaskData );
@@ -0,0 +1,8 @@
1
+ import model from 'tango-api-schema';
2
+
3
+ export async function find( query={}, field={} ) {
4
+ return model.planoStaticBrandCategories.find( query, field );
5
+ }
6
+ export async function findOne( query={}, field={} ) {
7
+ return model.planoStaticBrandCategories.findOne( query, field );
8
+ }