tango-app-api-store-builder 1.0.0-beta-122 → 1.0.0-beta-123
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
|
@@ -458,7 +458,7 @@ export async function updateFixtureStatus( req, res ) {
|
|
|
458
458
|
comment: req.body.comments,
|
|
459
459
|
};
|
|
460
460
|
console.log( comments );
|
|
461
|
-
|
|
461
|
+
|
|
462
462
|
let updateResponse = await planoTaskService.updateOnefilters(
|
|
463
463
|
{ _id: new mongoose.Types.ObjectId( req.body._id ) },
|
|
464
464
|
{
|
|
@@ -470,8 +470,29 @@ export async function updateFixtureStatus( req, res ) {
|
|
|
470
470
|
{ 'det._id': new mongoose.Types.ObjectId( req.body.DetailsId ) },
|
|
471
471
|
|
|
472
472
|
] );
|
|
473
|
+
if ( updateResponse&&updateResponse.answers.length>0 ) {
|
|
474
|
+
console.log( updateResponse.answers[0] );
|
|
475
|
+
let findissuse= updateResponse.answers[0].issues.filter( ( data ) => data._id==req.body.issueId );
|
|
476
|
+
console.log( findissuse );
|
|
477
|
+
let findDetails = findissuse[0].Details.filter( ( det ) => det.status==='pending' );
|
|
478
|
+
console.log( '======', findDetails.length );
|
|
479
|
+
if ( findDetails.length==0 ) {
|
|
480
|
+
await planoTaskService.updateOnefilters(
|
|
481
|
+
{ _id: new mongoose.Types.ObjectId( req.body._id ) },
|
|
482
|
+
{
|
|
483
|
+
$set: { 'answers.$[ans].issues.$[iss].status': 'completed' },
|
|
484
|
+
},
|
|
485
|
+
[
|
|
486
|
+
{ 'ans._id': new mongoose.Types.ObjectId( req.body.answerId ) },
|
|
487
|
+
{ 'iss._id': new mongoose.Types.ObjectId( req.body.issueId ) },
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
] );
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
473
494
|
if ( req.body.taskType==='layout' ) {
|
|
474
|
-
|
|
495
|
+
await planoTaskService.updateOnefilters(
|
|
475
496
|
{ _id: new mongoose.Types.ObjectId( req.body._id ) },
|
|
476
497
|
{
|
|
477
498
|
$push: { 'answers.$[ans].issues.$[iss].Details.$[det].comments': comments },
|
|
@@ -482,9 +503,8 @@ export async function updateFixtureStatus( req, res ) {
|
|
|
482
503
|
{ 'det._id': new mongoose.Types.ObjectId( req.body.DetailsId ) },
|
|
483
504
|
|
|
484
505
|
] );
|
|
485
|
-
console.log( updatecomment );
|
|
486
506
|
} else {
|
|
487
|
-
|
|
507
|
+
await planoTaskService.updateOnefilters(
|
|
488
508
|
{ _id: new mongoose.Types.ObjectId( req.body._id ) },
|
|
489
509
|
{
|
|
490
510
|
$push: { 'answers.$[ans].issues.$[iss].comments': comments },
|
|
@@ -493,9 +513,8 @@ export async function updateFixtureStatus( req, res ) {
|
|
|
493
513
|
{ 'ans._id': new mongoose.Types.ObjectId( req.body.answerId ) },
|
|
494
514
|
{ 'iss._id': new mongoose.Types.ObjectId( req.body.issueId ) },
|
|
495
515
|
] );
|
|
496
|
-
console.log( updatecomment );
|
|
497
516
|
}
|
|
498
|
-
|
|
517
|
+
|
|
499
518
|
|
|
500
519
|
res.sendSuccess( 'updated successfully' );
|
|
501
520
|
} catch ( e ) {
|
|
@@ -1326,8 +1326,10 @@ export async function getVmDetails( req, res ) {
|
|
|
1326
1326
|
if ( !getVmDetails ) {
|
|
1327
1327
|
return res.sendError( 'No data found', 204 );
|
|
1328
1328
|
}
|
|
1329
|
-
|
|
1330
|
-
|
|
1329
|
+
getVmDetails = getVmDetails.toObject();
|
|
1330
|
+
let templateDetails = await fixtureTemplateService.find( { 'vmConfig.vmId': { $in: req.query.vmId } } );
|
|
1331
|
+
if ( templateDetails.length && getVmDetails.status != 'draft' ) {
|
|
1332
|
+
getVmDetails.templateCount = templateDetails.length;
|
|
1331
1333
|
getVmDetails.status = 'inactive';
|
|
1332
1334
|
}
|
|
1333
1335
|
let fixtureDetails = await storeFixtureService.find( { 'vmConfig.vmId': { $in: req.query.vmId } }, { planoId: 1 } );
|
|
@@ -2323,9 +2323,9 @@ export async function updateVmData( req, res ) {
|
|
|
2323
2323
|
|
|
2324
2324
|
// import https from 'https';
|
|
2325
2325
|
// async function scrapeCrest() {
|
|
2326
|
-
// const storeIds = [ '
|
|
2326
|
+
// const storeIds = [ 'LKST3020' ];
|
|
2327
2327
|
// const apiUrl = 'https://api.getcrest.ai/api/ms_shelfsensei/layout/';
|
|
2328
|
-
// const bearerToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
|
|
2328
|
+
// const bearerToken = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0b2tlbl90eXBlIjoiYWNjZXNzIiwiZXhwIjoxNzUwMDU1OTMxLCJpYXQiOjE3NTAwNTIzMzEsImp0aSI6IjY5MGM1YTVhYjc3NDRlMmQ5YjlhMmZkYThhODM2MGYxIiwidXNlcl9pZCI6MTA4NSwiaWQiOjEwODUsImlzX21lZXNlZWtfYWNjb3VudCI6ZmFsc2UsImN1c3RvbWVyX2dyb3VwIjozOTgsImxpY2VuY2Vfc2NvcGVzIjpbeyJyZXNvdXJjZV9zZXQiOiJwcF9zZXQiLCJzY29wZV9yb2xlIjoiY29udHJpYnV0b3IifSx7InJlc291cmNlX3NldCI6ImRwX3NldCIsInNjb3BlX3JvbGUiOiJjb250cmlidXRvciJ9LHsicmVzb3VyY2Vfc2V0IjoiZGZfc2V0Iiwic2NvcGVfcm9sZSI6ImNvbnRyaWJ1dG9yIn0seyJyZXNvdXJjZV9zZXQiOiJkZWZhdWx0X3NldCIsInNjb3BlX3JvbGUiOiJjb250cmlidXRvciJ9XX0.juirYxGNCsCe75vwgL2AR9_LeFsr8r4cJmEdygRZGO0';
|
|
2329
2329
|
// const filePath = 'response.json';
|
|
2330
2330
|
// let allResults = [];
|
|
2331
2331
|
|
|
@@ -3124,6 +3124,7 @@ export async function storeFixturesTaskv2( req, res ) {
|
|
|
3124
3124
|
const vmDetails = await Promise.all( fixture.toObject()?.vmConfig?.map( async ( vm ) => {
|
|
3125
3125
|
totalVmCount += 1;
|
|
3126
3126
|
const vmInfo = await planoVmService.findOne( { _id: vm.vmId } );
|
|
3127
|
+
console.log( vmInfo?.toObject() );
|
|
3127
3128
|
return {
|
|
3128
3129
|
...vm,
|
|
3129
3130
|
...vmInfo?.toObject(),
|
|
@@ -3146,7 +3147,7 @@ export async function storeFixturesTaskv2( req, res ) {
|
|
|
3146
3147
|
disabled: req?.body?.redo ? disabled : false,
|
|
3147
3148
|
vmCount: vmCount,
|
|
3148
3149
|
shelfConfig: shelfDetails,
|
|
3149
|
-
|
|
3150
|
+
vmConfig: vmDetails,
|
|
3150
3151
|
};
|
|
3151
3152
|
} ),
|
|
3152
3153
|
);
|
|
@@ -3665,9 +3666,33 @@ export async function planoList( req, res ) {
|
|
|
3665
3666
|
|
|
3666
3667
|
let planoList = await planoService.find( { clientId: req.body.clientId }, { _id: 1 } );
|
|
3667
3668
|
let idList = planoList?.map( ( ele ) => new mongoose.Types.ObjectId( ele._id ) );
|
|
3668
|
-
let planoTaskDetails = await planotaskService.find( { planoId: { $in: idList }, checklistStatus: 'submit' } );
|
|
3669
|
-
idList = planoTaskDetails.map( ( ele ) => new mongoose.Types.ObjectId( ele.planoId ) );
|
|
3670
3669
|
let taskQuery = [
|
|
3670
|
+
{
|
|
3671
|
+
$match: {
|
|
3672
|
+
client_id: req.body.clientId,
|
|
3673
|
+
planoId: { $in: idList },
|
|
3674
|
+
},
|
|
3675
|
+
},
|
|
3676
|
+
{
|
|
3677
|
+
$group: {
|
|
3678
|
+
_id: '$planoType',
|
|
3679
|
+
checklistStatus: { $last: '$checklistStatus' },
|
|
3680
|
+
planoId: { $last: '$planoId' },
|
|
3681
|
+
},
|
|
3682
|
+
},
|
|
3683
|
+
{
|
|
3684
|
+
$project: {
|
|
3685
|
+
_id: 0,
|
|
3686
|
+
checklistStatus: 1,
|
|
3687
|
+
planoId: 1,
|
|
3688
|
+
},
|
|
3689
|
+
},
|
|
3690
|
+
];
|
|
3691
|
+
let planoTaskDetails = await planotaskService.aggregate( taskQuery );
|
|
3692
|
+
console.log( planoTaskDetails );
|
|
3693
|
+
idList = planoTaskDetails.map( ( ele ) => new mongoose.Types.ObjectId( ele.planoId ) );
|
|
3694
|
+
console.log( idList, 'list' );
|
|
3695
|
+
taskQuery = [
|
|
3671
3696
|
{
|
|
3672
3697
|
$match: {
|
|
3673
3698
|
planoId: { $in: idList },
|
|
@@ -744,7 +744,7 @@ export async function generatetaskDetails( req, res ) {
|
|
|
744
744
|
planoId: { $last: '$planoId' },
|
|
745
745
|
taskId: { $push: '$_id' },
|
|
746
746
|
checklistStatus: { $last: '$checklistStatus' },
|
|
747
|
-
date_string: { $
|
|
747
|
+
date_string: { $last: '$date_string' },
|
|
748
748
|
},
|
|
749
749
|
},
|
|
750
750
|
{
|
|
@@ -760,7 +760,6 @@ export async function generatetaskDetails( req, res ) {
|
|
|
760
760
|
},
|
|
761
761
|
];
|
|
762
762
|
let taskDetails = await processedService.aggregate( query );
|
|
763
|
-
console.log( taskDetails.flatMap( ( ele ) => ele.taskId ) );
|
|
764
763
|
// ...( req.body.store.length ) ? { storeName: { $in: req.body.store } } : {}, taskId: { $in: taskDetails.flatMap( ( ele ) => ele.taskId ) } },
|
|
765
764
|
let processedTaskDetails = await planoTaskService.find( { date_string: { $gte: req.body.fromDate, $lte: req.body.toDate }, type: 'layout' }, { status: 1, planoId: 1, date_string: 1, _id: 0, taskId: 1 } );
|
|
766
765
|
console.log( processedTaskDetails.length );
|
|
@@ -778,8 +777,7 @@ export async function generatetaskDetails( req, res ) {
|
|
|
778
777
|
} ) );
|
|
779
778
|
|
|
780
779
|
processedTaskDetails.forEach( ( item ) => {
|
|
781
|
-
let taskIndex = taskDetails.findIndex( ( taskItem ) => taskItem.checklistStatus =='submit' && taskItem.date_string
|
|
782
|
-
console.log( taskIndex, 'index' );
|
|
780
|
+
let taskIndex = taskDetails.findIndex( ( taskItem ) => taskItem.checklistStatus =='submit' && taskItem.date_string == item.date_string && item.planoId.toString() == taskItem.planoId.toString() );
|
|
783
781
|
if ( taskIndex != -1 ) {
|
|
784
782
|
taskDetails[taskIndex].storeStatus = item.status == 'complete' ? 'yes' : 'No';
|
|
785
783
|
}
|
|
@@ -790,13 +788,14 @@ export async function generatetaskDetails( req, res ) {
|
|
|
790
788
|
} );
|
|
791
789
|
|
|
792
790
|
|
|
793
|
-
let completeStore = taskDetails.filter( ( ele ) => ele.checklistStatus
|
|
791
|
+
let completeStore = taskDetails.filter( ( ele ) => ele.checklistStatus == 'submit' );
|
|
794
792
|
completeStore = completeStore.reduce( ( acc, ele ) => {
|
|
795
793
|
if ( !acc[ele.storeName] ) {
|
|
796
794
|
acc[ele.storeName] = {
|
|
797
795
|
storeName: ele.storeName,
|
|
798
796
|
status: 'submit',
|
|
799
797
|
storeStatus: ele.storeStatus,
|
|
798
|
+
date: ele.date_string,
|
|
800
799
|
};
|
|
801
800
|
}
|
|
802
801
|
return acc;
|
|
@@ -805,15 +804,17 @@ export async function generatetaskDetails( req, res ) {
|
|
|
805
804
|
completeStore = Object.values( completeStore );
|
|
806
805
|
|
|
807
806
|
let completeStoreList =completeStore.map( ( item ) => item.storeName );
|
|
807
|
+
console.log( taskDetails );
|
|
808
808
|
|
|
809
|
-
let incompleteStore = taskDetails.filter( ( ele ) =>
|
|
809
|
+
let incompleteStore = taskDetails.filter( ( ele ) => ele.checklistStatus != 'submit' );
|
|
810
810
|
|
|
811
811
|
incompleteStore = incompleteStore.reduce( ( acc, ele ) => {
|
|
812
812
|
if ( !acc[ele.storeName] ) {
|
|
813
813
|
acc[ele.storeName] = {
|
|
814
814
|
storeName: ele.storeName,
|
|
815
|
-
status: ele.checklistStatus
|
|
815
|
+
status: ele.checklistStatus,
|
|
816
816
|
storeStatus: ele.storeStatus,
|
|
817
|
+
date: ele.date_string,
|
|
817
818
|
};
|
|
818
819
|
}
|
|
819
820
|
return acc;
|