tango-app-api-store-builder 1.0.0-beta-219 → 1.0.0-beta-220

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-219",
3
+ "version": "1.0.0-beta-220",
4
4
  "description": "storeBuilder",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1371,8 +1371,6 @@ export async function updateStoreFixture( req, res ) {
1371
1371
  let subTemplate = await fixtureConfigService.create( templateData );
1372
1372
  configId = subTemplate._id;
1373
1373
 
1374
- console.log( subTemplate, 'subTemplate' );
1375
-
1376
1374
  data.fixtureConfigId = subTemplate._id;
1377
1375
  data.masterTemplateId = fixtureMasterTemplate._id;
1378
1376
  } else {
@@ -11,7 +11,7 @@ import * as planoVmService from '../service/planoVm.service.js';
11
11
  import * as planoMappingService from '../service/planoMapping.service.js';
12
12
  import * as planoTaskService from '../service/planoTask.service.js';
13
13
  import * as processedTaskService from '../service/processedTaskservice.js';
14
- // import * as planoComplianceService from '../service/planoCompliance.service.js';
14
+ import * as planoComplianceService from '../service/planoCompliance.service.js';
15
15
  // import * as planoTaskComplianceService from '../service/planoTask.service.js';
16
16
  // import * as planoQrConversionRequestService from '../service/planoQrConversionRequest.service.js';
17
17
  import * as planoProductCategoryService from '../service/planoproductCategory.service.js';
@@ -9739,4 +9739,55 @@ export async function getAllPlanoIds(req, res){
9739
9739
  console.log("@@ ~ getAllPlanoIds [ERR]:", error);
9740
9740
  return res.sendError(e, 500);
9741
9741
  }
9742
+ }
9743
+
9744
+ export async function createComplianceFromMappins(req, res) {
9745
+ try {
9746
+ const { planoId, fixtureId } = req.body;
9747
+
9748
+ if (!planoId) {
9749
+ res.sendError('PlanoId is required', 400);
9750
+ }
9751
+
9752
+ if (!fixtureId) {
9753
+ res.sendError('FixtureId is required', 400);
9754
+ }
9755
+
9756
+ const allMappings = await planoMappingService.find({ planoId: planoId, fixtureId: fixtureId, type: 'product' });
9757
+
9758
+ const allCompliance = [];
9759
+
9760
+ for (let i = 0; i < allMappings.length; i++) {
9761
+ const mapping = allMappings[i];
9762
+ const complianceDoc = {
9763
+ "clientId": "11",
9764
+ "storeName": "LKST2255",
9765
+ "storeId": "11-1984",
9766
+ "type": "product",
9767
+ "planoId": new mongoose.Types.ObjectId(mapping.planoId),
9768
+ "floorId": new mongoose.Types.ObjectId(mapping.floorId),
9769
+ "fixtureId": new mongoose.Types.ObjectId(mapping.fixtureId),
9770
+ "shelfId": new mongoose.Types.ObjectId(mapping.shelfId),
9771
+ "productId": new mongoose.Types.ObjectId(mapping.productId),
9772
+ "rfId": "CCC094850431",
9773
+ "compliance": "proper",
9774
+ "date": new Date(),
9775
+ "planoMappingId": new mongoose.Types.ObjectId(mapping._id)
9776
+ };
9777
+
9778
+ const res = await planoComplianceService.create(complianceDoc);
9779
+ if (res) {
9780
+ allCompliance.push(res);
9781
+ }
9782
+ }
9783
+
9784
+ if (allCompliance) {
9785
+ return res.sendSuccess({ mappings: allCompliance, count: allCompliance.length });
9786
+ } else {
9787
+ return res.sendError("No mapping data found", 204)
9788
+ }
9789
+ } catch (error) {
9790
+ console.log("@@ ~ createComplianceFromMappins [ERR]: ", error);
9791
+ return res.sendError(e, 500);
9792
+ }
9742
9793
  }
@@ -2447,7 +2447,7 @@ export const checkPlanoExist = async ( req, res ) => {
2447
2447
  const plano = await planoService.findOne( { storeName: req.body.store } );
2448
2448
 
2449
2449
  if ( plano ) {
2450
- return res.sendSuccess( { rfId: plano?.isRfid ?? false } );
2450
+ return res.sendSuccess( true );
2451
2451
  } else {
2452
2452
  return res.sendSuccess( false );
2453
2453
  }
@@ -33,5 +33,6 @@ scriptRouter
33
33
  .post( '/migrateCrest', scriptController.migrateCrestv1 )
34
34
  .post( '/updatePlanoMappings', scriptController.updatePlanoMappings )
35
35
  .post( '/productMappings', scriptController.productMappings )
36
+ .post( '/complianceFromMappings', scriptController.createComplianceFromMappins )
36
37
  .get( '/getAllPlanoIdsM', scriptController.getAllPlanoIds )
37
38
  ;