tango-app-api-store-builder 1.0.0-beta-112 → 1.0.0-beta-114

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.
@@ -64,7 +64,7 @@ export async function getplanoFeedback( req, res ) {
64
64
  $match: {
65
65
  planoId: new mongoose.Types.ObjectId( req.body.planoId ),
66
66
  floorId: new mongoose.Types.ObjectId( req.body.floorId ),
67
- type: { $ne: 'layout' },
67
+ type: 'fixture',
68
68
  },
69
69
  },
70
70
  {
@@ -96,7 +96,7 @@ export async function getplanoFeedback( req, res ) {
96
96
  }, { $unwind: { path: '$taskData', preserveNullAndEmptyArrays: true } },
97
97
  {
98
98
  $lookup: {
99
- from: 'fixtureconfigs',
99
+ from: 'storefixtures',
100
100
  let: { 'fixtureId': '$fixtureId' },
101
101
  pipeline: [
102
102
  {
@@ -109,6 +109,27 @@ export async function getplanoFeedback( req, res ) {
109
109
  },
110
110
  },
111
111
  ],
112
+ as: 'storeFixtureData',
113
+ },
114
+ },
115
+ {
116
+ $unwind: { path: '$storeFixtureData', preserveNullAndEmptyArrays: true },
117
+ },
118
+ {
119
+ $lookup: {
120
+ from: 'fixtureconfigs',
121
+ let: { 'fixtureConfigId': '$storeFixtureData.fixtureConfigId' },
122
+ pipeline: [
123
+ {
124
+ $match: {
125
+ $expr: {
126
+ $and: [
127
+ { $eq: [ '$_id', '$$fixtureConfigId' ] },
128
+ ],
129
+ },
130
+ },
131
+ },
132
+ ],
112
133
  as: 'FixtureData',
113
134
  },
114
135
  },
@@ -119,8 +140,91 @@ export async function getplanoFeedback( req, res ) {
119
140
 
120
141
 
121
142
  let findfixtureCompliance = await planoTaskService.aggregate( queryfixture );
122
- console.log( findfixtureCompliance );
123
- res.sendSuccess( { count: findfixtureCompliance.length, layoutData: findPlanoCompliance, fixtureData: findfixtureCompliance } );
143
+ let queryVm = [];
144
+
145
+
146
+ queryVm.push( {
147
+ $match: {
148
+ planoId: new mongoose.Types.ObjectId( req.body.planoId ),
149
+ floorId: new mongoose.Types.ObjectId( req.body.floorId ),
150
+ type: 'vm',
151
+ },
152
+ },
153
+ {
154
+ $lookup: {
155
+ from: 'processedtasks',
156
+ let: { 'taskId': '$taskId' },
157
+ pipeline: [
158
+ {
159
+ $match: {
160
+ $expr: {
161
+ $and: [
162
+ { $eq: [ '$_id', '$$taskId' ] },
163
+ ],
164
+ },
165
+ },
166
+ },
167
+ {
168
+ $project: {
169
+ 'userName': 1,
170
+ 'createdAt': 1,
171
+ 'createdByName': 1,
172
+ 'submitTime_string': 1,
173
+ },
174
+ },
175
+ ],
176
+ as: 'taskData',
177
+ },
178
+
179
+ }, { $unwind: { path: '$taskData', preserveNullAndEmptyArrays: true } },
180
+ {
181
+ $lookup: {
182
+ from: 'storefixtures',
183
+ let: { 'fixtureId': '$fixtureId' },
184
+ pipeline: [
185
+ {
186
+ $match: {
187
+ $expr: {
188
+ $and: [
189
+ { $eq: [ '$_id', '$$fixtureId' ] },
190
+ ],
191
+ },
192
+ },
193
+ },
194
+ ],
195
+ as: 'storeFixtureData',
196
+ },
197
+ },
198
+ {
199
+ $unwind: { path: '$storeFixtureData', preserveNullAndEmptyArrays: true },
200
+ },
201
+ {
202
+ $lookup: {
203
+ from: 'fixtureconfigs',
204
+ let: { 'fixtureConfigId': '$storeFixtureData.fixtureConfigId' },
205
+ pipeline: [
206
+ {
207
+ $match: {
208
+ $expr: {
209
+ $and: [
210
+ { $eq: [ '$_id', '$$fixtureConfigId' ] },
211
+ ],
212
+ },
213
+ },
214
+ },
215
+ ],
216
+ as: 'FixtureData',
217
+ },
218
+ },
219
+ {
220
+ $unwind: { path: '$FixtureData', preserveNullAndEmptyArrays: true },
221
+ },
222
+ );
223
+
224
+
225
+ let findvmCompliance = await planoTaskService.aggregate( queryVm );
226
+ console.log( findvmCompliance );
227
+ res.sendSuccess( { count: findfixtureCompliance.length, layoutData: findPlanoCompliance, fixtureData: findfixtureCompliance, VmData: findvmCompliance } );
124
228
  } catch ( e ) {
125
229
  logger.error( { functionName: 'getplanoFeedback', error: e, message: req.body } );
126
230
  return res.sendError( e, 500 );
@@ -384,3 +488,23 @@ export async function updateFixtureStatus( req, res ) {
384
488
  return res.sendError( e, 500 );
385
489
  }
386
490
  }
491
+
492
+ export async function updateStoreFixture( req, res ) {
493
+ try {
494
+ const { fixtureId, data } = req.body;
495
+
496
+ const update = await storeFixtureService.updateOne( { _id: new mongoose.Types.ObjectId( fixtureId ) }, data );
497
+
498
+ console.log( update );
499
+
500
+ data.shelfConfig.forEach( async ( shelf ) => {
501
+ await fixtureShelfService.updateOne( { _id: new mongoose.Types.ObjectId( shelf._id ) }, shelf );
502
+ } );
503
+
504
+
505
+ res.sendSuccess( 'Updated Successfully' );
506
+ } catch ( e ) {
507
+ logger.error( { functionName: 'updateStoreFixture', error: e } );
508
+ return res.sendError( e, 500 );
509
+ }
510
+ }
@@ -143,6 +143,14 @@ export async function createFixture( req, res ) {
143
143
  fixtureCategory: req.body.fixtureCategory,
144
144
  fixtureType: req.body.fixtureType,
145
145
  fixtureLibCode: FixLibCode,
146
+ fixtureStaticLength: {
147
+ 'value': 1524,
148
+ 'unit': 'mm',
149
+ },
150
+ fixtureStaticWidth: {
151
+ 'value': 1220,
152
+ 'unit': 'mm',
153
+ },
146
154
  };
147
155
  let fixtLibraryDetails = await planoLibraryService.create( data );
148
156
  return res.sendSuccess( fixtLibraryDetails );
@@ -412,6 +420,10 @@ export async function FixtureLibraryList( req, res ) {
412
420
  },
413
421
  },
414
422
  );
423
+ } else {
424
+ query.push( {
425
+ $sort: { _id: -1 },
426
+ } );
415
427
  }
416
428
  query.push(
417
429
  {
@@ -834,22 +846,25 @@ export async function uploadBrandList( req, res ) {
834
846
  let inputData = req.body;
835
847
 
836
848
  let brandData = inputData.brandData.reduce( ( acc, ele ) => {
849
+ console.log( ele?.category, ele );
837
850
  if ( !acc[ele.brandName] ) {
838
851
  acc[ele.brandName] = {
839
852
  brandName: ele.brandName,
840
853
  clientId: inputData.clientId,
841
- category: [ ...new Set( ele.category ) ],
842
- subCategory: [ ...new Set( ele.subCategory ) ],
854
+ category: [ ...new Set( ele?.category?.map( ( ele ) => ele ) ) ],
855
+ subCategory: [ ...new Set( ele?.subCategory?.map( ( ele ) => ele ) ) ],
843
856
  };
844
857
  } else {
845
858
  acc[ele.brandName].category.push( ...ele.category );
846
- acc[ele.brandName].subCategory.push( ...ele.subCategory );
859
+ if ( ele?.subCategory.length ) {
860
+ acc[ele.brandName].subCategory.push( ...ele?.subCategory );
861
+ }
847
862
  }
848
863
  return acc;
849
864
  }, {} );
850
865
 
851
866
  await planoProductService.deleteMany( { clientId: inputData.clientId, _id: { $nin: inputData.brandUsedList } } );
852
- await planoProductService.insertMany( brandData );
867
+ await planoProductService.insertMany( Object.values( brandData ) );
853
868
  // await Promise.all( Object.keys( brandData ).map( async ( ele ) => {
854
869
  // await planoProductService.updateOne( { brandName: { $regex: brandData[ele].brandName, $options: 'i' }, clientId: req.body.clientId }, brandData[ele] );
855
870
  // } ) );
@@ -1117,6 +1132,10 @@ export async function getVmLibList( req, res ) {
1117
1132
  },
1118
1133
  },
1119
1134
  );
1135
+ } else {
1136
+ query.push( {
1137
+ $sort: { _id: -1 },
1138
+ } );
1120
1139
  }
1121
1140
  query.push(
1122
1141
  {