tango-app-api-store-builder 1.0.0-beta-168 → 1.0.0-beta-169

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-168",
3
+ "version": "1.0.0-beta-169",
4
4
  "description": "storeBuilder",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -22,10 +22,6 @@ export async function createTemplate( req, res ) {
22
22
  if ( !getLibDetails ) {
23
23
  return res.sendError( 'Fixture library id is wrong', 400 );
24
24
  }
25
- let fixtureCapacity = getLibDetails.shelfConfig.reduce(
26
- ( acc, ele ) => ele.trayRows ? acc + ( ele.trayRows * ele.productPerShelf ) : ( acc + ele.productPerShelf ),
27
- 0,
28
- );
29
25
  let templateId = await getTemplateId( getLibDetails.fixtureCategory, getLibDetails.fixtureWidth );
30
26
  let templateData = {
31
27
  clientId: inputData.clientId,
@@ -40,7 +36,7 @@ export async function createTemplate( req, res ) {
40
36
  header: getLibDetails.header,
41
37
  footer: getLibDetails.footer,
42
38
  isBodyEnabled: getLibDetails.isBodyEnabled,
43
- fixtureCapacity: fixtureCapacity,
39
+ fixtureCapacity: getLibDetails.fixtureCapacity,
44
40
  fixtureStaticLength: {
45
41
  value: 1524,
46
42
  unit: 'mm',
@@ -84,21 +80,12 @@ export async function updateTemplate( req, res ) {
84
80
  let templateData = { ...templateDetails, ...inputData };
85
81
  newFixture = await fixtureConfigService.create( templateData );
86
82
  }
87
- let fixtureCapacity = inputData.shelfConfig.reduce( ( acc, ele ) => {
88
- if ( ele.shelfType == 'tray' ) {
89
- ele.productPerShelf = ele.trayRows * ele.productPerShelf;
90
- }
91
- acc = acc + ele.productPerShelf;
92
- return acc;
93
- },
94
- 0 );
95
83
 
96
84
  let storeFixtureDetails = await storeFixtureService.find( { fixtureConfigId: req.params.templateId } );
97
85
  if ( storeFixtureDetails.length ) {
98
86
  let fixtureList = storeFixtureDetails.map( ( ele ) => ele._id );
99
87
  let fixtureData = {
100
88
  ...inputData,
101
- fixtureCapacity: fixtureCapacity,
102
89
  fixtureConfigId: newFixture ? newFixture._id : req.params.templateId,
103
90
  };
104
91
  delete fixtureData._id;
@@ -109,8 +96,8 @@ export async function updateTemplate( req, res ) {
109
96
  let shelfData = [];
110
97
  inputData.shelfConfig.forEach( ( ele, index ) => {
111
98
  shelfData.push( {
112
- productCategory: inputData.productCategory,
113
- productSubCategory: inputData.productCategory,
99
+ productCategory: ele.productCategory,
100
+ productSubCategory: ele.productSubCategory,
114
101
  shelfType: ele.shelfType,
115
102
  trayRows: ele.trayRows,
116
103
  shelfNumber: index + 1,