tango-app-api-store-builder 1.0.0-beta-160 → 1.0.0-beta-162
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
|
@@ -167,7 +167,7 @@ function buildPipelineByType( type, planoId, floorId, filterByStatus, filterByAp
|
|
|
167
167
|
},
|
|
168
168
|
];
|
|
169
169
|
|
|
170
|
-
const vmStages =
|
|
170
|
+
const vmStages = [ 'vm', 'vmRollout' ].includes( type ) ? [
|
|
171
171
|
{
|
|
172
172
|
$unwind: { path: '$FixtureData.vmConfig', preserveNullAndEmptyArrays: true },
|
|
173
173
|
},
|
|
@@ -180,7 +180,7 @@ function buildPipelineByType( type, planoId, floorId, filterByStatus, filterByAp
|
|
|
180
180
|
$match: { $expr: { $eq: [ '$_id', '$$vmId' ] } },
|
|
181
181
|
},
|
|
182
182
|
{
|
|
183
|
-
$project: { vmName: 1 },
|
|
183
|
+
$project: { vmName: 1, vmType: 1 },
|
|
184
184
|
},
|
|
185
185
|
],
|
|
186
186
|
as: 'vmDetails',
|
|
@@ -192,6 +192,7 @@ function buildPipelineByType( type, planoId, floorId, filterByStatus, filterByAp
|
|
|
192
192
|
{
|
|
193
193
|
$set: {
|
|
194
194
|
'FixtureData.vmConfig.vmName': '$vmDetails.vmName',
|
|
195
|
+
'FixtureData.vmConfig.vmType': '$vmDetails.vmType',
|
|
195
196
|
},
|
|
196
197
|
},
|
|
197
198
|
{
|
|
@@ -647,6 +648,78 @@ export async function updateFixtureStatus( req, res ) {
|
|
|
647
648
|
}
|
|
648
649
|
}
|
|
649
650
|
|
|
651
|
+
export async function updateRolloutStatus( req, res ) {
|
|
652
|
+
try {
|
|
653
|
+
let comments = {
|
|
654
|
+
userId: req.user._id,
|
|
655
|
+
userName: req.user.userName,
|
|
656
|
+
role: req.user.role,
|
|
657
|
+
responsetype: req.body.type,
|
|
658
|
+
comment: req.body.comments,
|
|
659
|
+
};
|
|
660
|
+
|
|
661
|
+
let updateResponse = await planoTaskService.updateOnefilters(
|
|
662
|
+
{ _id: new mongoose.Types.ObjectId( req.body._id ) },
|
|
663
|
+
{
|
|
664
|
+
$set: { 'answers.$[ans].issues.$[iss].Details.$[det].status': req.body.type },
|
|
665
|
+
},
|
|
666
|
+
[
|
|
667
|
+
{ 'ans._id': new mongoose.Types.ObjectId( req.body.answerId ) },
|
|
668
|
+
{ 'iss._id': new mongoose.Types.ObjectId( req.body.issueId ) },
|
|
669
|
+
{ 'det._id': new mongoose.Types.ObjectId( req.body.DetailsId ) },
|
|
670
|
+
|
|
671
|
+
] );
|
|
672
|
+
if ( updateResponse && updateResponse.answers.length > 0 ) {
|
|
673
|
+
let findissuse = updateResponse.answers[0].issues.filter( ( data ) => data._id == req.body.issueId );
|
|
674
|
+
let findDetails = findissuse[0].Details.filter( ( det ) => det.status === 'agree' );
|
|
675
|
+
if ( findissuse[0].Details.length === findDetails.length ) {
|
|
676
|
+
await planoTaskService.updateOnefilters(
|
|
677
|
+
{ _id: new mongoose.Types.ObjectId( req.body._id ) },
|
|
678
|
+
{
|
|
679
|
+
$set: { 'answers.$[ans].issues.$[iss].status': 'completed' },
|
|
680
|
+
},
|
|
681
|
+
[
|
|
682
|
+
{ 'ans._id': new mongoose.Types.ObjectId( req.body.answerId ) },
|
|
683
|
+
{ 'iss._id': new mongoose.Types.ObjectId( req.body.issueId ) },
|
|
684
|
+
] );
|
|
685
|
+
}
|
|
686
|
+
let findoneplanoData = await planoTaskService.findOne( { _id: new mongoose.Types.ObjectId( req.body._id ) } );
|
|
687
|
+
let totalApproved = findoneplanoData.answers[0].issues.filter( ( data ) => data.status === 'pending' );
|
|
688
|
+
if ( totalApproved.length === 0 ) {
|
|
689
|
+
await planoTaskService.updateOne(
|
|
690
|
+
{
|
|
691
|
+
_id: new mongoose.Types.ObjectId( req.body._id ),
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
'status': 'complete',
|
|
695
|
+
},
|
|
696
|
+
);
|
|
697
|
+
let data = {};
|
|
698
|
+
if ( req.body.type == 'vmRollout' ) {
|
|
699
|
+
data['isVmEdited'] = false;
|
|
700
|
+
} else {
|
|
701
|
+
data['isMerchEdited'] = false;
|
|
702
|
+
}
|
|
703
|
+
await storeFixtureService.updateOne( { _id: updateResponse.fixtureId }, data );
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
await planoTaskService.updateOnefilters(
|
|
707
|
+
{ _id: new mongoose.Types.ObjectId( req.body._id ) },
|
|
708
|
+
{
|
|
709
|
+
$push: { 'answers.$[ans].issues.$[iss].comments': comments },
|
|
710
|
+
},
|
|
711
|
+
[
|
|
712
|
+
{ 'ans._id': new mongoose.Types.ObjectId( req.body.answerId ) },
|
|
713
|
+
{ 'iss._id': new mongoose.Types.ObjectId( req.body.issueId ) },
|
|
714
|
+
] );
|
|
715
|
+
res.sendSuccess( 'updated successfully' );
|
|
716
|
+
} catch ( e ) {
|
|
717
|
+
logger.error( { functionName: 'updateFixtureStatus', error: e } );
|
|
718
|
+
return res.sendError( e, 500 );
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
|
|
650
723
|
export async function updateStoreFixture( req, res ) {
|
|
651
724
|
try {
|
|
652
725
|
const { fixtureId, data } = req.body;
|
|
@@ -15,7 +15,7 @@ import * as floorService from '../service/storeBuilder.service.js';
|
|
|
15
15
|
import * as planoStaticService from '../service/planoStaticData.service.js';
|
|
16
16
|
import * as assignService from '../service/assignService.service.js';
|
|
17
17
|
import * as storeBuilderService from '../service/storeBuilder.service.js';
|
|
18
|
-
import * as
|
|
18
|
+
import * as storeFixtureService from '../service/storeFixture.service.js';
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
dayjs.extend( timeZone );
|
|
@@ -669,6 +669,11 @@ export async function updateAnswersv2( req, res ) {
|
|
|
669
669
|
await sendMessageToQueue( `${sqs.url}${sqs.storeBuilder}`, JSON.stringify( sqsData ) );
|
|
670
670
|
}
|
|
671
671
|
|
|
672
|
+
if ( data.status == 'complete' && [ 'merchRollout', 'vmRollout' ].includes( data.type ) ) {
|
|
673
|
+
let query = data.type == 'merchRollout' ? { isMerchEdited: false } : { isVmEdited: false };
|
|
674
|
+
await storeFixtureService.updateOne( { _id: req.body.fixtureId }, query );
|
|
675
|
+
}
|
|
676
|
+
|
|
672
677
|
return res.sendSuccess( 'Fixture details updated successfully' );
|
|
673
678
|
} catch ( e ) {
|
|
674
679
|
logger.error( { functionName: 'updateAnswers', error: e } );
|
|
@@ -1032,11 +1037,11 @@ export async function redoTask( req, res ) {
|
|
|
1032
1037
|
|
|
1033
1038
|
export async function revokeTask( req, res ) {
|
|
1034
1039
|
try {
|
|
1035
|
-
if(!req.body.taskId) {
|
|
1036
|
-
return res.sendError('Checklist type is required',400)
|
|
1040
|
+
if ( !req.body.taskId ) {
|
|
1041
|
+
return res.sendError( 'Checklist type is required', 400 );
|
|
1037
1042
|
}
|
|
1038
|
-
await processedService.deleteMany( { _id:req.body.taskId } );
|
|
1039
|
-
return res.sendSuccess('Task revoked successfully');
|
|
1043
|
+
await processedService.deleteMany( { _id: req.body.taskId } );
|
|
1044
|
+
return res.sendSuccess( 'Task revoked successfully' );
|
|
1040
1045
|
} catch ( e ) {
|
|
1041
1046
|
logger.error( { functionName: 'revokeTask', error: e } );
|
|
1042
1047
|
return res.sendError( e, 500 );
|
|
@@ -21,4 +21,5 @@ managePlanoRouter
|
|
|
21
21
|
.post( '/createRevision', managePlanoController.createPlanoRevision )
|
|
22
22
|
.post( '/getRevisions', managePlanoController.getAllPlanoRevisions )
|
|
23
23
|
.post( '/getRevisionData', managePlanoController.getPlanoRevisionById )
|
|
24
|
-
.post( '/getRolloutFeedback', managePlanoController.getRolloutFeedback )
|
|
24
|
+
.post( '/getRolloutFeedback', managePlanoController.getRolloutFeedback )
|
|
25
|
+
.post( '/updateRolloutStatus', isAllowedSessionHandler, managePlanoController.updateRolloutStatus );
|