tango-app-api-store-builder 1.0.0-beta-14 → 1.0.0-beta-15

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-14",
3
+ "version": "1.0.0-beta-15",
4
4
  "description": "storeBuilder",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -577,6 +577,7 @@ export async function storeFixturesv1( req, res ) {
577
577
  return {
578
578
  ...fixture.toObject(),
579
579
  status: complianceCount === 0 ? '' : complianceCount === productCount ? 'complete' : 'incomplete',
580
+ productCount: productCount,
580
581
  };
581
582
  } ),
582
583
  );
@@ -606,14 +607,18 @@ export async function storeFixturesv1( req, res ) {
606
607
  return {
607
608
  ...fixture.toObject(),
608
609
  status: complianceCount === 0 ? '' : complianceCount === productCount ? 'complete' : 'incomplete',
610
+ productCount: productCount,
609
611
  };
610
612
  } ),
611
613
  );
612
614
 
615
+ const productCount = await planoMappingService.count( { floorId: floor._id } );
616
+
613
617
  return {
614
618
  ...floor.toObject(),
615
619
  layoutPolygon: layoutPolygonWithFixtures,
616
620
  centerFixture: centerFixturesWithStatus,
621
+ productCount: productCount,
617
622
  };
618
623
  } ),
619
624
  );
@@ -1213,6 +1218,7 @@ export async function scanv1( req, res ) {
1213
1218
  };
1214
1219
  const misplacedProductMapping = await planoMappingService.findOne( misplacedQuery );
1215
1220
 
1221
+
1216
1222
  if ( !misplacedProductMapping ) {
1217
1223
  const shelf = await fixtureShelfService.findOne( misplacedQuery );
1218
1224
  if ( !shelf ) {
@@ -1221,6 +1227,7 @@ export async function scanv1( req, res ) {
1221
1227
  return res.sendSuccess( { shelfId: shelf.toObject()._id } );
1222
1228
  }
1223
1229
 
1230
+
1224
1231
  const misplacedProductShelf = await fixtureShelfService.findOne( { _id: misplacedProductMapping.toObject().shelfId } );
1225
1232
 
1226
1233
  let misplacedProductDetails = await planoProductService.findOne( { _id: misplacedProductMapping.toObject().productId } );
@@ -1232,6 +1239,9 @@ export async function scanv1( req, res ) {
1232
1239
  await planoComplianceService.updateOne( { ...misplacedQuery, date: currentDate }, complianceData );
1233
1240
  return res.sendSuccess( { data: { ...misplacedProductMapping.toObject(), ...( misplacedProductDetails ? misplacedProductDetails?.toObject() : {} ) }, status: true } );
1234
1241
  } else {
1242
+ if ( shelf.toObject()._id.toString() !== misplacedProductShelf.toObject()._id.toString() ) {
1243
+ return res.sendError( 'RFID conflict with section', 400 );
1244
+ }
1235
1245
  const complianceData = { ...misplacedProductMapping.toObject(), planoMappingId: misplacedProductMapping.toObject()._id, compliance: 'misplaced' };
1236
1246
  delete complianceData._id;
1237
1247
 
@@ -1240,6 +1250,7 @@ export async function scanv1( req, res ) {
1240
1250
  }
1241
1251
  }
1242
1252
 
1253
+
1243
1254
  const complianceData = { ...productMapping.toObject(), compliance: 'proper' };
1244
1255
  delete complianceData._id;
1245
1256
 
@@ -1353,14 +1364,13 @@ export async function updateMissing( req, res ) {
1353
1364
  }
1354
1365
 
1355
1366
  const mappingCompliance = await planoComplianceService.findOne( {
1356
- shelfId: mapping.shelfId,
1357
- shelfPosition: mapping.shelfPosition,
1367
+ planoMappingId: mapping._id,
1358
1368
  date: currentDate,
1359
1369
  } );
1360
1370
 
1361
1371
  if ( !mappingCompliance ) {
1362
1372
  delete mapping.toObject()._id;
1363
- planoComplianceService.create( { ...mapping.toObject(), compliance: 'missing', date: currentDate } );
1373
+ planoComplianceService.create( { ...mapping.toObject(), planoMappingId: mapping._id, compliance: 'missing', date: currentDate } );
1364
1374
  }
1365
1375
 
1366
1376
  return {