tango-app-api-store-builder 1.0.0-beta-154 → 1.0.0-beta-155

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-154",
3
+ "version": "1.0.0-beta-155",
4
4
  "description": "storeBuilder",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -32,7 +32,7 @@
32
32
  "path": "^0.12.7",
33
33
  "selenium-webdriver": "^4.31.0",
34
34
  "sharp": "^0.34.1",
35
- "tango-api-schema": "^2.2.191",
35
+ "tango-api-schema": "^2.2.192",
36
36
  "tango-app-api-middleware": "3.1.48",
37
37
  "url": "^0.11.4",
38
38
  "winston": "^3.17.0",
@@ -7630,6 +7630,7 @@ export async function migrateCrestv1( req, res ) {
7630
7630
 
7631
7631
  let fixtureCounter = 1;
7632
7632
 
7633
+ let leftAssociatedElementFixtureNumber = 1;
7633
7634
 
7634
7635
  for ( let index = 0; index < leftFixtures.length; index++ ) {
7635
7636
  const fixture = leftFixtures[index];
@@ -7879,10 +7880,12 @@ export async function migrateCrestv1( req, res ) {
7879
7880
  // 'y': 0,
7880
7881
  // 'unit': 'ft',
7881
7882
  // },
7882
- 'associatedElementFixtureNumber': index+1,
7883
+ 'associatedElementFixtureNumber': leftAssociatedElementFixtureNumber,
7883
7884
  'fixtureConfigId': fixtureTemplate.toObject()._id,
7884
7885
  };
7885
7886
 
7887
+ leftAssociatedElementFixtureNumber += 1;
7888
+
7886
7889
  delete fixtureData._id;
7887
7890
  delete fixtureData.shelfConfig;
7888
7891
 
@@ -7925,6 +7928,8 @@ export async function migrateCrestv1( req, res ) {
7925
7928
  } );
7926
7929
  }
7927
7930
 
7931
+ let backAssociatedElementFixtureNumber = 1;
7932
+
7928
7933
  for ( let index = 0; index < backFixtures.length; index++ ) {
7929
7934
  const fixture = backFixtures[index];
7930
7935
 
@@ -8172,10 +8177,12 @@ export async function migrateCrestv1( req, res ) {
8172
8177
  // 'y': roundToTwo( ( ( index * ( ( constantDetailedFixtureWidth/mmToFeet ) ) ) + ( ( leftFixtures.length ? 1 : 0 ) * constantDetailedFixtureWidth/mmToFeet ) ) ),
8173
8178
  // 'unit': 'ft',
8174
8179
  // },
8175
- 'associatedElementFixtureNumber': index+1,
8180
+ 'associatedElementFixtureNumber': backAssociatedElementFixtureNumber,
8176
8181
  'fixtureConfigId': fixtureTemplate.toObject()._id,
8177
8182
  };
8178
8183
 
8184
+ backAssociatedElementFixtureNumber += 1;
8185
+
8179
8186
  delete fixtureData._id;
8180
8187
  delete fixtureData.shelfConfig;
8181
8188
 
@@ -8218,6 +8225,8 @@ export async function migrateCrestv1( req, res ) {
8218
8225
  } );
8219
8226
  }
8220
8227
 
8228
+ let rightAssociatedElementFixtureNumber = 1;
8229
+
8221
8230
  for ( let index = 0; index < rightFixtures.length; index++ ) {
8222
8231
  const fixture = rightFixtures[index];
8223
8232
 
@@ -8465,10 +8474,12 @@ export async function migrateCrestv1( req, res ) {
8465
8474
  // 'y': roundToTwo( ( finalYDetailedDistance - ( constantDetailedFixtureWidth / mmToFeet ) ) ),
8466
8475
  // 'unit': 'ft',
8467
8476
  // },
8468
- 'associatedElementFixtureNumber': index+1,
8477
+ 'associatedElementFixtureNumber': rightAssociatedElementFixtureNumber,
8469
8478
  'fixtureConfigId': fixtureTemplate.toObject()._id,
8470
8479
  };
8471
8480
 
8481
+ rightAssociatedElementFixtureNumber += 1;
8482
+
8472
8483
  delete fixtureData._id;
8473
8484
  delete fixtureData.shelfConfig;
8474
8485
 
@@ -8511,6 +8522,8 @@ export async function migrateCrestv1( req, res ) {
8511
8522
  } );
8512
8523
  }
8513
8524
 
8525
+ let centerAssociatedElementFixtureNumber = 1;
8526
+
8514
8527
  for ( let index = 0; index < floorFixtures.length; index++ ) {
8515
8528
  const fixture = floorFixtures[index];
8516
8529
 
@@ -8746,10 +8759,12 @@ export async function migrateCrestv1( req, res ) {
8746
8759
  // 'y': detailedYPos,
8747
8760
  // 'unit': 'ft',
8748
8761
  // },
8749
- 'associatedElementFixtureNumber': index+1,
8762
+ 'associatedElementFixtureNumber': centerAssociatedElementFixtureNumber,
8750
8763
  'fixtureConfigId': fixtureTemplate.toObject()._id,
8751
8764
  };
8752
8765
 
8766
+ centerAssociatedElementFixtureNumber += 1;
8767
+
8753
8768
  delete fixtureData._id;
8754
8769
  delete fixtureData.shelfConfig;
8755
8770
 
@@ -3349,8 +3349,6 @@ export async function planoList( req, res ) {
3349
3349
  $lookup: {
3350
3350
  from: 'planotaskcompliances',
3351
3351
  let: {
3352
- // plano: '$_id',
3353
- task: { $ifNull: [ '$taskIds', [] ] },
3354
3352
  floor: '$layout.id',
3355
3353
  },
3356
3354
  pipeline: [
@@ -3358,10 +3356,8 @@ export async function planoList( req, res ) {
3358
3356
  $match: {
3359
3357
  $expr: {
3360
3358
  $and: [
3361
- // { $eq: [ '$planoId', '$$plano' ] },
3362
3359
  { $eq: [ '$floorId', '$$floor' ] },
3363
- // { $in: [ '$taskId', pendingDetails.map( ( ele ) => ele.taskId ) ] },
3364
- // { $eq: [ '$taskType', 'initial' ] },
3360
+ { $eq: [ '$status', 'incomplete' ] },
3365
3361
  ],
3366
3362
  },
3367
3363
  },
@@ -3443,7 +3439,7 @@ export async function planoList( req, res ) {
3443
3439
  },
3444
3440
  {
3445
3441
  $group: {
3446
- _id: '',
3442
+ _id: '$floorId',
3447
3443
  layoutCount: {
3448
3444
  $sum: { $cond: [ { $eq: [ '$type', 'layout' ] }, 1, 0 ] },
3449
3445
  },
@@ -3509,38 +3505,6 @@ export async function planoList( req, res ) {
3509
3505
  },
3510
3506
  },
3511
3507
  },
3512
- // {
3513
- // $group: {
3514
- // _id: null,
3515
- // layoutCount: { $sum: '$layoutCount' },
3516
- // fixtureCount: { $sum: '$fixtureCount' },
3517
- // vmCount: { $sum: '$vmCount' },
3518
- // completeLayout: {
3519
- // $sum: {
3520
- // $cond: {
3521
- // if: {
3522
- // $and: [
3523
- // { '$gt': [ '$layoutCount', 0 ] },
3524
- // { '$gt': [ '$layoutPending', 0 ] },
3525
- // { '$gt': [ '$fixtureCount', 0 ] },
3526
- // { '$gt': [ '$fixturePending', 0 ] },
3527
- // { '$gt': [ '$vmCount', 0 ] },
3528
- // { '$gt': [ '$fixturePending', 0 ] },
3529
- // ],
3530
- // },
3531
- // then: 1,
3532
- // else: 0,
3533
- // },
3534
- // },
3535
- // },
3536
- // layoutPending: { $sum: '$layoutPending' },
3537
- // fixturePending: { $sum: '$fixturePending' },
3538
- // vmPending: { $sum: '$vmPending' },
3539
- // layoutDisagree: { $sum: '$layoutDisagree' },
3540
- // fixtureDisagree: { $sum: '$fixtureDisagree' },
3541
- // vmDisagree: { $sum: '$vmDisagree' },
3542
- // },
3543
- // },
3544
3508
  {
3545
3509
  $project: {
3546
3510
  _id: 0,
@@ -3601,7 +3565,9 @@ export async function planoList( req, res ) {
3601
3565
  {
3602
3566
  $eq: [ '$fixturePending', 0 ],
3603
3567
  },
3604
- { $eq: [ '$fixtureDisagree', 0 ] },
3568
+ {
3569
+ $eq: [ '$fixtureDisagree', 0 ],
3570
+ },
3605
3571
  ],
3606
3572
  },
3607
3573
  then: 'complete',
@@ -3629,39 +3595,18 @@ export async function planoList( req, res ) {
3629
3595
  if: {
3630
3596
  $and: [
3631
3597
  {
3632
- $gt: [
3633
- '$fixtureCount',
3634
- 0,
3635
- ],
3598
+ $gt: [ '$fixtureCount', 0 ],
3636
3599
  },
3637
3600
  {
3638
3601
  $gt: [
3639
- '$fixturePending',
3602
+ '$fixtureDisagree',
3640
3603
  0,
3641
3604
  ],
3642
3605
  },
3643
3606
  ],
3644
3607
  },
3645
- then: 'pending',
3646
- else: {
3647
- $cond: {
3648
- if: {
3649
- $and: [
3650
- {
3651
- $gt: [ '$fixtureCount', 0 ],
3652
- },
3653
- {
3654
- $gt: [
3655
- '$fixtureDisagree',
3656
- 0,
3657
- ],
3658
- },
3659
- ],
3660
- },
3661
- then: 'disagree',
3662
- else: '',
3663
- },
3664
- },
3608
+ then: 'disagree',
3609
+ else: '',
3665
3610
  },
3666
3611
  },
3667
3612
  },
@@ -3716,7 +3661,7 @@ export async function planoList( req, res ) {
3716
3661
  layoutCount: 1,
3717
3662
  fixtureCount: 1,
3718
3663
  vmCount: 1,
3719
- completeLayout: 1,
3664
+ // completeLayout: 1,
3720
3665
  layoutDisagree: 1,
3721
3666
  fixtureDisagree: 1,
3722
3667
  vmDisagree: 1,
@@ -3739,9 +3684,20 @@ export async function planoList( req, res ) {
3739
3684
  planoProgress: 1,
3740
3685
  createdAt: 1,
3741
3686
  lastUpdate: '$updatedAt',
3742
- taskDetails: { $ifNull: [ { $arrayElemAt: [ '$taskDetails', 0 ] }, {} ] },
3743
3687
  planoTask: { $ifNull: [ '$planoTask', [] ] },
3744
3688
  layoutCount: 1,
3689
+ taskDetails: {
3690
+ $let: {
3691
+ vars: {
3692
+ task: { $arrayElemAt: [ '$taskDetails', 0 ] },
3693
+ },
3694
+ in: {
3695
+ layoutStatus: { $ifNull: [ '$$task.layoutStatus', '' ] },
3696
+ fixtureStatus: { $ifNull: [ '$$task.fixtureStatus', '' ] },
3697
+ vmStatus: { $ifNull: [ '$$task.vmStatus', '' ] },
3698
+ },
3699
+ },
3700
+ },
3745
3701
  },
3746
3702
  },
3747
3703
  ];
@@ -3850,7 +3806,7 @@ export async function planoList( req, res ) {
3850
3806
  } );
3851
3807
  }
3852
3808
  if ( inputData.filter.status.includes( 'completed' ) ) {
3853
- orQuery.push( { $and: [ { 'taskDetails.layoutStatus': 'complete' }, { 'taskDetails.fixtureStatus': 'complete' }, { 'taskDetails.vmStatus': 'complete' } ] } );
3809
+ orQuery.push( { $and: [ { 'taskDetails.layoutStatus': '' }, { 'taskDetails.fixtureStatus': '' }, { 'taskDetails.vmStatus': '' } ] } );
3854
3810
  }
3855
3811
  if ( inputData.filter.status.includes( 'yetToAssign' ) ) {
3856
3812
  orQuery.push( { $expr: { $eq: [ { $size: '$planoTask' }, 0 ] } } );
@@ -4283,41 +4239,41 @@ export async function getTaskDetails( req, res ) {
4283
4239
  },
4284
4240
  },
4285
4241
  },
4286
- {
4287
- $group: {
4288
- _id: null,
4289
- layoutCount: { $sum: '$layoutCount' },
4290
- fixtureCount: { $sum: '$fixtureCount' },
4291
- vmCount: { $sum: '$vmCount' },
4292
- completeLayout: {
4293
- $sum: {
4294
- $cond: {
4295
- if: {
4296
- $and: [
4297
- { '$gt': [ '$layoutCount', 0 ] },
4298
- { '$eq': [ '$layoutPending', 0 ] },
4299
- { '$eq': [ '$layoutDisagree', 0 ] },
4300
- { '$gt': [ '$fixtureCount', 0 ] },
4301
- { '$eq': [ '$fixturePending', 0 ] },
4302
- { '$eq': [ '$fixtureDisagree', 0 ] },
4303
- { '$gt': [ '$vmCount', 0 ] },
4304
- { '$eq': [ '$vmPending', 0 ] },
4305
- { '$eq': [ '$vmDisagree', 0 ] },
4306
- ],
4307
- },
4308
- then: 1,
4309
- else: 0,
4310
- },
4311
- },
4312
- },
4313
- layoutPending: { $sum: '$layoutPending' },
4314
- fixturePending: { $sum: '$fixturePending' },
4315
- vmPending: { $sum: '$vmPending' },
4316
- layoutDisagree: { $sum: '$layoutDisagree' },
4317
- fixtureDisagree: { $sum: '$fixtureDisagree' },
4318
- vmDisagree: { $sum: '$vmDisagree' },
4319
- },
4320
- },
4242
+ // {
4243
+ // $group: {
4244
+ // _id: null,
4245
+ // layoutCount: { $sum: '$layoutCount' },
4246
+ // fixtureCount: { $sum: '$fixtureCount' },
4247
+ // vmCount: { $sum: '$vmCount' },
4248
+ // completeLayout: {
4249
+ // $sum: {
4250
+ // $cond: {
4251
+ // if: {
4252
+ // $and: [
4253
+ // { '$gt': [ '$layoutCount', 0 ] },
4254
+ // { '$eq': [ '$layoutPending', 0 ] },
4255
+ // { '$eq': [ '$layoutDisagree', 0 ] },
4256
+ // { '$gt': [ '$fixtureCount', 0 ] },
4257
+ // { '$eq': [ '$fixturePending', 0 ] },
4258
+ // { '$eq': [ '$fixtureDisagree', 0 ] },
4259
+ // { '$gt': [ '$vmCount', 0 ] },
4260
+ // { '$eq': [ '$vmPending', 0 ] },
4261
+ // { '$eq': [ '$vmDisagree', 0 ] },
4262
+ // ],
4263
+ // },
4264
+ // then: 1,
4265
+ // else: 0,
4266
+ // },
4267
+ // },
4268
+ // },
4269
+ // layoutPending: { $sum: '$layoutPending' },
4270
+ // fixturePending: { $sum: '$fixturePending' },
4271
+ // vmPending: { $sum: '$vmPending' },
4272
+ // layoutDisagree: { $sum: '$layoutDisagree' },
4273
+ // fixtureDisagree: { $sum: '$fixtureDisagree' },
4274
+ // vmDisagree: { $sum: '$vmDisagree' },
4275
+ // },
4276
+ // },
4321
4277
  {
4322
4278
  $project: {
4323
4279
  _id: 0,
@@ -4474,7 +4430,7 @@ export async function getTaskDetails( req, res ) {
4474
4430
  layoutCount: 1,
4475
4431
  fixtureCount: 1,
4476
4432
  vmCount: 1,
4477
- completeLayout: 1,
4433
+ // completeLayout: 1,
4478
4434
  layoutDisagree: 1,
4479
4435
  fixtureDisagree: 1,
4480
4436
  vmDisagree: 1,
@@ -4,7 +4,7 @@ import * as storeService from '../service/store.service.js';
4
4
  import * as processedChecklistService from '../service/processedchecklist.service.js';
5
5
  import * as userService from '../service/user.service.js';
6
6
  import dayjs from 'dayjs';
7
- import { logger, fileUpload, signedUrl, insertOpenSearchData } from 'tango-app-api-middleware';
7
+ import { logger, fileUpload, signedUrl, insertOpenSearchData, sendMessageToQueue } from 'tango-app-api-middleware';
8
8
  import * as planoTaskService from '../service/planoTask.service.js';
9
9
  import * as planoService from '../service/planogram.service.js';
10
10
  import * as checklistService from '../service/checklist.service.js';
@@ -647,6 +647,17 @@ export async function updateAnswersv2( req, res ) {
647
647
  }
648
648
 
649
649
  await insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).planotaskcompliances, data );
650
+ if ( req.body.type==='layout' ) {
651
+ let sqsData = {
652
+ bucket: JSON.parse( process.env.BUCKET ).storeBuilder,
653
+ date_string: dayjs().format( 'YYYY-MM-DD' ),
654
+ storeName: data?.storeName,
655
+ videoPath: data?.answers[0]?.video,
656
+ };
657
+
658
+ const sqs = JSON.parse( process.env.SQS );
659
+ await sendMessageToQueue( `${sqs.url}${sqs.storeBuilder}`, JSON.stringify( sqsData ) );
660
+ }
650
661
 
651
662
  return res.sendSuccess( 'Fixture details updated successfully' );
652
663
  } catch ( e ) {