tango-app-api-store-builder 1.0.0-beta-121 → 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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tango-app-api-store-builder",
|
|
3
|
-
"version": "1.0.0-beta-
|
|
3
|
+
"version": "1.0.0-beta-123",
|
|
4
4
|
"description": "storeBuilder",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"selenium-webdriver": "^4.31.0",
|
|
34
34
|
"sharp": "^0.34.1",
|
|
35
35
|
"tango-api-schema": "2.2.155",
|
|
36
|
-
"tango-app-api-middleware": "
|
|
36
|
+
"tango-app-api-middleware": "3.1.48",
|
|
37
37
|
"url": "^0.11.4",
|
|
38
38
|
"winston": "^3.17.0",
|
|
39
39
|
"winston-daily-rotate-file": "^5.0.0",
|
|
@@ -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 },
|
|
@@ -415,11 +415,12 @@ export async function uploadImage( req, res ) {
|
|
|
415
415
|
return res.sendError( 'Please upload a file', 400 );
|
|
416
416
|
}
|
|
417
417
|
console.log( req.files );
|
|
418
|
+
console.log( req.files.file );
|
|
418
419
|
let params = {
|
|
419
420
|
Bucket: JSON.parse( process.env.BUCKET ).storeBuilder,
|
|
420
421
|
Key: `${req.body.taskId}/${req.body.qno}/${Date.now()}/`,
|
|
421
422
|
fileName: req.files.file.name,
|
|
422
|
-
ContentType: req.files.file.mimeType?req.files.file.mimeType:req.files.file.mimetype,
|
|
423
|
+
ContentType: req.files.file.mimeType&&req.files.file.mimeType!=undefined?req.files.file.mimeType:req.files.file.mimetype,
|
|
423
424
|
body: req.files.file.data,
|
|
424
425
|
};
|
|
425
426
|
let fileRes = await fileUpload( params );
|
|
@@ -743,7 +744,7 @@ export async function generatetaskDetails( req, res ) {
|
|
|
743
744
|
planoId: { $last: '$planoId' },
|
|
744
745
|
taskId: { $push: '$_id' },
|
|
745
746
|
checklistStatus: { $last: '$checklistStatus' },
|
|
746
|
-
date_string: { $
|
|
747
|
+
date_string: { $last: '$date_string' },
|
|
747
748
|
},
|
|
748
749
|
},
|
|
749
750
|
{
|
|
@@ -759,7 +760,6 @@ export async function generatetaskDetails( req, res ) {
|
|
|
759
760
|
},
|
|
760
761
|
];
|
|
761
762
|
let taskDetails = await processedService.aggregate( query );
|
|
762
|
-
console.log( taskDetails.flatMap( ( ele ) => ele.taskId ) );
|
|
763
763
|
// ...( req.body.store.length ) ? { storeName: { $in: req.body.store } } : {}, taskId: { $in: taskDetails.flatMap( ( ele ) => ele.taskId ) } },
|
|
764
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 } );
|
|
765
765
|
console.log( processedTaskDetails.length );
|
|
@@ -777,8 +777,7 @@ export async function generatetaskDetails( req, res ) {
|
|
|
777
777
|
} ) );
|
|
778
778
|
|
|
779
779
|
processedTaskDetails.forEach( ( item ) => {
|
|
780
|
-
let taskIndex = taskDetails.findIndex( ( taskItem ) => taskItem.checklistStatus =='submit' && taskItem.date_string
|
|
781
|
-
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() );
|
|
782
781
|
if ( taskIndex != -1 ) {
|
|
783
782
|
taskDetails[taskIndex].storeStatus = item.status == 'complete' ? 'yes' : 'No';
|
|
784
783
|
}
|
|
@@ -789,13 +788,14 @@ export async function generatetaskDetails( req, res ) {
|
|
|
789
788
|
} );
|
|
790
789
|
|
|
791
790
|
|
|
792
|
-
let completeStore = taskDetails.filter( ( ele ) => ele.checklistStatus
|
|
791
|
+
let completeStore = taskDetails.filter( ( ele ) => ele.checklistStatus == 'submit' );
|
|
793
792
|
completeStore = completeStore.reduce( ( acc, ele ) => {
|
|
794
793
|
if ( !acc[ele.storeName] ) {
|
|
795
794
|
acc[ele.storeName] = {
|
|
796
795
|
storeName: ele.storeName,
|
|
797
796
|
status: 'submit',
|
|
798
797
|
storeStatus: ele.storeStatus,
|
|
798
|
+
date: ele.date_string,
|
|
799
799
|
};
|
|
800
800
|
}
|
|
801
801
|
return acc;
|
|
@@ -804,15 +804,17 @@ export async function generatetaskDetails( req, res ) {
|
|
|
804
804
|
completeStore = Object.values( completeStore );
|
|
805
805
|
|
|
806
806
|
let completeStoreList =completeStore.map( ( item ) => item.storeName );
|
|
807
|
+
console.log( taskDetails );
|
|
807
808
|
|
|
808
|
-
let incompleteStore = taskDetails.filter( ( ele ) =>
|
|
809
|
+
let incompleteStore = taskDetails.filter( ( ele ) => ele.checklistStatus != 'submit' );
|
|
809
810
|
|
|
810
811
|
incompleteStore = incompleteStore.reduce( ( acc, ele ) => {
|
|
811
812
|
if ( !acc[ele.storeName] ) {
|
|
812
813
|
acc[ele.storeName] = {
|
|
813
814
|
storeName: ele.storeName,
|
|
814
|
-
status: ele.checklistStatus
|
|
815
|
+
status: ele.checklistStatus,
|
|
815
816
|
storeStatus: ele.storeStatus,
|
|
817
|
+
date: ele.date_string,
|
|
816
818
|
};
|
|
817
819
|
}
|
|
818
820
|
return acc;
|