tango-app-api-store-builder 1.0.0-beta-189 → 1.0.0-beta-191

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-189",
3
+ "version": "1.0.0-beta-191",
4
4
  "description": "storeBuilder",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1378,12 +1378,31 @@ export async function getTreeList( req, res ) {
1378
1378
  let fixtureDetails = await fixtureConfigService.aggregate( query );
1379
1379
  if ( req?.query?.masterId ) {
1380
1380
  fixtureDetails = await Promise.all( fixtureDetails.map( async ( fixt ) => {
1381
- let storeFixtureCount = await storeFixtureService.count( { fixtureConfigId: fixt._id } );
1381
+ let query = [
1382
+ {
1383
+ $match: {
1384
+ fixtureConfigId: new ObjectId( fixt._id ),
1385
+ },
1386
+ },
1387
+ {
1388
+ $group: {
1389
+ _id: '',
1390
+ store: { $addToSet: '$storeId' },
1391
+ },
1392
+ },
1393
+ {
1394
+ $project: {
1395
+ _id: 0,
1396
+ storeCount: { $size: '$store' },
1397
+ },
1398
+ },
1399
+ ];
1400
+ let storeFixtureCount = await storeFixtureService.aggregate( query );
1382
1401
  fixt.vmConfig = await Promise.all( fixt.vmConfig.map( async ( vm ) => {
1383
1402
  let vmDetails = await vmService.findOne( { _id: vm.vmId }, { _id: 0 } );
1384
1403
  return { ...vm, ...vmDetails?.toObject() };
1385
1404
  } ) );
1386
- return { ...fixt, storeCount: storeFixtureCount };
1405
+ return { ...fixt, storeCount: storeFixtureCount?.[0]?.storeCount || 0 };
1387
1406
  } ) );
1388
1407
  }
1389
1408
  return res.sendSuccess( fixtureDetails );
@@ -3076,9 +3076,9 @@ export async function storeFixturesTaskv2( req, res ) {
3076
3076
  disabled = false;
3077
3077
  }
3078
3078
  }
3079
- if ( compliance?.taskType == 'redo' ) {
3080
- disabled = false;
3081
- }
3079
+ // if ( compliance?.taskType == 'redo' ) {
3080
+ // disabled = false;
3081
+ // }
3082
3082
 
3083
3083
  return {
3084
3084
  ...fixture.toObject(),
@@ -3178,9 +3178,9 @@ export async function storeFixturesTaskv2( req, res ) {
3178
3178
  disabled = false;
3179
3179
  }
3180
3180
  }
3181
- if ( compliance?.taskType == 'redo' ) {
3182
- disabled = false;
3183
- }
3181
+ // if ( compliance?.taskType == 'redo' && compl) {
3182
+ // disabled = false;
3183
+ // }
3184
3184
 
3185
3185
  return {
3186
3186
  ...fixture.toObject(),
@@ -142,7 +142,13 @@ export async function createTask( req, res ) {
142
142
  delete payload._id;
143
143
  delete payload.createdAt;
144
144
  delete payload.updatedAt;
145
- let response = await processedService.create( payload );
145
+ let response;
146
+ if ( [ 'merchRollout', 'vmRollout' ].includes( taskInfo?.planoType ) ) {
147
+ response = await processedService.create( payload );
148
+ } else {
149
+ await processedService.updateOne( { _id: req.body.taskId }, payload );
150
+ response = { _id: req.body.taskId };
151
+ }
146
152
  return res.sendSuccess( { message: 'Task redo triggered successfully', taskId: response?._id } );
147
153
  } else {
148
154
  if ( !req.body?.checkListName ) {