tango-app-api-store-builder 1.0.19 → 1.0.20

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.
@@ -27,7 +27,6 @@ import fs from 'fs';
27
27
  import os from 'os';
28
28
  import { fileURLToPath } from 'url';
29
29
  import path from 'path';
30
- const ObjectId=mongoose.Types.ObjectId;
31
30
 
32
31
  const __filename = fileURLToPath( import.meta.url );
33
32
  const __dirname = path.dirname( __filename );
@@ -14503,8 +14502,8 @@ export async function getstoreFixtureExcel( req, res ) {
14503
14502
  "Middle Masking": ele.fixtureType != 'floor' ? fixtureVm.find( ( vm ) => midShelfNumber.includes( vm.startYPosition ) && vm.startYPosition != midShelfNumber[midShelfNumber.length - 1] && !vm.vmName.includes( 'Leatherite' ) )?.vmName : '',
14504
14503
  "Leatherite": ele.fixtureType != 'floor' ? fixtureVm.find( ( vm ) => vm.vmName.includes( 'Leatherite' ) )?.vmName : '',
14505
14504
  "Lower Middle Masking": ele.fixtureType != 'floor' ? fixtureVm.find( ( vm ) => vm.startYPosition == midShelfNumber[midShelfNumber.length - 1] )?.vmName : '',
14506
- "Bottom Slanter": ele.fixtureType != 'floor' ? fixtureVm.find( ( vm ) => vm.startYPosition == ele.shelfConfig.length && vm.yZone == 'stretch' && vm.xZone == 'stretch' )?.vmName : '',
14507
- "Bottom Mid": ele.fixtureType != 'floor' ? fixtureVm.find( ( vm ) => bottomShelfNumber.includes( vm.startYPosition ) && vm.yZone == 'stretch' && vm.xZone != 'stretch' )?.vmName : '',
14505
+ "Bottom Slander": ele.fixtureType != 'floor' ? fixtureVm.find( ( vm ) => vm.startYPosition == ele.shelfConfig.length && vm.yZone == 'stretch' && vm.xZone == 'stretch' )?.vmName : '',
14506
+ "Bottom Mid": ele.fixtureType != 'floor' ? fixtureVm.find( ( vm ) => vm.startYPosition == ele.shelfConfig.length && vm.yZone == 'stretch' && vm.xZone != 'stretch' )?.vmName : '',
14508
14507
  "Euro Center Type": ele.fixtureType == 'floor' ? ele.fixtureCategory +'-'+ ele.fixtureWidth.value +' '+ ele.fixtureWidth.unit : '',
14509
14508
  "Euro Center VM": ele.fixtureType == 'floor' ? fixtureVm.map( ( ele ) => ele.vmName )?.toString() : '',
14510
14509
  },
@@ -17359,91 +17358,6 @@ async function createUser( data ) {
17359
17358
  }
17360
17359
  }
17361
17360
 
17362
- export async function createLayout( req, res ) {
17363
- try {
17364
- let storeDetails = await storeService.find( { storeName: { $in: req.body.storeName }, clientId: req.body.clientId, status: 'active' }, { storeName: 1, storeId: 1 } );
17365
- if ( !storeDetails ) {
17366
- return res.sendError( 'No data found', 204 );
17367
- }
17368
- await Promise.all( storeDetails.map( async ( store ) => {
17369
- let planoDetails = await storeBuilderService.find( { storeName: store.storeName }, { planoId: 1, _id: 1 } );
17370
- await Promise.all( planoDetails.map( async ( task ) => {
17371
- let getLayoutDetails = await processedTaskService.findOne( { storeName: store.storeName, planoType: 'layout' }, { _id: 1 } );
17372
- if ( !getLayoutDetails ) {
17373
- let data = {
17374
- client_id: req.body.clientId,
17375
- date_iso: new Date( dayjs().format( 'YYYY-MM-DD' ) ),
17376
- date_string: dayjs().format( 'YYYY-MM-DD' ),
17377
- sourceCheckList_id: new ObjectId(),
17378
- checkListName: 'Layout Verification',
17379
- checkListId: new ObjectId(),
17380
- scheduleStartTime: dayjs().format( 'hh:mm A' ),
17381
- scheduleEndTime: dayjs().format( 'hh:mm A' ),
17382
- scheduleStartTime_iso: dayjs().format(),
17383
- scheduleEndTime_iso: dayjs().format(),
17384
- allowedOverTime: false,
17385
- allowedStoreLocation: false,
17386
- createdBy: new ObjectId(),
17387
- createdByName: 'tango',
17388
- questionAnswers: [],
17389
- isdeleted: false,
17390
- questionCount: 0,
17391
- storeCount: 0,
17392
- locationCount: 0,
17393
- checkListType: 'task',
17394
- country: '',
17395
- store_id: store.storeId,
17396
- storeName: store.storeName,
17397
- userId: new ObjectId(),
17398
- userName: 'tango',
17399
- userEmail: 'tango@tangotech.co.in',
17400
- checklistStatus: 'submit',
17401
- timeFlagStatus: true,
17402
- timeFlag: 0,
17403
- questionFlag: 0,
17404
- mobileDetectionFlag: 0,
17405
- storeOpenCloseFlag: 0,
17406
- reinitiateStatus: false,
17407
- markasread: false,
17408
- uniformDetectionFlag: 0,
17409
- scheduleRepeatedType: 'daily',
17410
- approvalStatus: false,
17411
- approvalEnable: false,
17412
- redoStatus: false,
17413
- isPlano: true,
17414
- planoType: 'layout',
17415
- planoId: task.planoId,
17416
- floorId: task._id,
17417
- };
17418
-
17419
- let taskData = await processedTaskService.create( data );
17420
- let layoutData = {
17421
- "date_string": dayjs().format( 'YYYY-MM-DD' ),
17422
- "floorId": task._id,
17423
- "fixtureId": null,
17424
- "planoId": task.planoId,
17425
- "taskType": "initial",
17426
- "type": "layout",
17427
- "taskId": taskData._id,
17428
- "answers": [],
17429
- "approvalStatus": "approved",
17430
- "date_iso": new Date( dayjs().format( 'YYYY-MM-DD' ) ),
17431
- "status": "complete",
17432
- "storeId": store.storeId,
17433
- "storeName": store.storeName,
17434
- };
17435
- await planoTaskService.create( layoutData );
17436
- await storeBuilderService.updateOne( { _id: task._id }, { planoProgress: 50 } );
17437
- }
17438
- } ) );
17439
- } ) );
17440
- return res.sendSuccess( 'Layout SUbmitted Successfully' );
17441
- } catch ( e ) {
17442
- logger.error( { functionName: 'createLayout', error: e } );
17443
- return res.sendError( e, 500 );
17444
- }
17445
- }
17446
-
17447
17361
  async function standardizeHeaders() {
17448
17362
  const headerMap = {
17449
17363
  "Innovation": "Innovation",
@@ -18623,37 +18537,3 @@ async function updateMellerCollection() {
18623
18537
 
18624
18538
  // updateMellerCollection();
18625
18539
 
18626
-
18627
- export async function updateProduct( req, res ) {
18628
- try {
18629
- let fixtureDetails = await storeFixtureService.findOne( { _id: req.body.fixtureId } );
18630
- if ( !fixtureDetails ) {
18631
- return res.sendError( 'No data found', 204 );
18632
- }
18633
- fixtureDetails['readerId'] = req.body.macId;
18634
- fixtureDetails.save();
18635
- let getProducts = await planoProductService.findSort( { brandName: { $ne: null } }, {}, { brandName: 1 } );
18636
- let rfIdList = req.body.shelfDetails.flatMap( ( ele ) => ele.rfIdList );
18637
- await Promise.all( rfIdList.map( async ( idList, index ) => {
18638
- getProducts[index]['rfId']= idList;
18639
- await planoProductService.updateOne( { _id: getProducts[index]._id }, { rfId: idList } );
18640
- } ) );
18641
- if ( getProducts.length ) {
18642
- let shelfDetails = await fixtureShelfService.findOne( { fixtureId: req.body.fixtureId } );
18643
- let fixtureShelf = [];
18644
- for ( let [ index, shelf ] of req.body.shelfDetails.entries() ) {
18645
- let brandName = [ ...new Set( getProducts.filter( ( ele ) => shelf.rfIdList.includes( ele.rfId ) ).map( ( ele ) => ele.brandName ) ) ];
18646
- fixtureShelf.push( { ...shelfDetails.toObject(), shelfNumber: index + 1, productBrandName: brandName, antennaNo: shelf.antennaNo, zone: shelf.zone, productPerShelf: shelf.rfIdList.length } );
18647
- }
18648
-
18649
- console.log( fixtureShelf, 'fixtureShelf' );
18650
- await fixtureShelfService.deleteMany( { fixtureId: req.body.fixtureId } );
18651
- await fixtureShelfService.insertMany( { fixtureShelf } );
18652
- }
18653
-
18654
- return res.sendSuccess( 'Updated Successfully' );
18655
- } catch ( e ) {
18656
- logger.error( { functionName: "updateProduct", error: e } );
18657
- return res.sendError( e, 500 );
18658
- }
18659
- }