tango-app-api-store-builder 1.0.0-beta-127 → 1.0.0-beta-129
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
|
@@ -252,6 +252,10 @@ export async function getplanoFeedback( req, res ) {
|
|
|
252
252
|
{
|
|
253
253
|
$project: {
|
|
254
254
|
'_id': 1,
|
|
255
|
+
'type': 1,
|
|
256
|
+
'type': 1,
|
|
257
|
+
'taskId': 1,
|
|
258
|
+
'taskData': 1,
|
|
255
259
|
'answers': 1,
|
|
256
260
|
'createdAt': 1,
|
|
257
261
|
'date_iso': 1,
|
|
@@ -311,9 +315,18 @@ export async function getplanoFeedback( req, res ) {
|
|
|
311
315
|
planoId: { $first: '$planoId' },
|
|
312
316
|
status: { $first: '$status' },
|
|
313
317
|
taskType: { $first: '$taskType' },
|
|
318
|
+
type: { $first: '$type' },
|
|
319
|
+
taskId: { $first: '$taskId' },
|
|
320
|
+
taskData: { $first: '$taskData' },
|
|
314
321
|
baseFixtureData: { $first: '$FixtureData' },
|
|
315
322
|
collectedVmConfigs: {
|
|
316
|
-
$push:
|
|
323
|
+
$push: {
|
|
324
|
+
$cond: [
|
|
325
|
+
{ $ne: [ '$FixtureData.vmConfig', {} ] },
|
|
326
|
+
'$FixtureData.vmConfig',
|
|
327
|
+
'$$REMOVE',
|
|
328
|
+
],
|
|
329
|
+
},
|
|
317
330
|
},
|
|
318
331
|
},
|
|
319
332
|
},
|
|
@@ -329,6 +342,9 @@ export async function getplanoFeedback( req, res ) {
|
|
|
329
342
|
planoId: 1,
|
|
330
343
|
status: 1,
|
|
331
344
|
taskType: 1,
|
|
345
|
+
type: 1,
|
|
346
|
+
taskId: 1,
|
|
347
|
+
taskData: 1,
|
|
332
348
|
FixtureData: {
|
|
333
349
|
$mergeObjects: [
|
|
334
350
|
'$baseFixtureData',
|
|
@@ -607,13 +623,13 @@ export async function updateFixtureStatus( req, res ) {
|
|
|
607
623
|
{ 'det._id': new mongoose.Types.ObjectId( req.body.DetailsId ) },
|
|
608
624
|
|
|
609
625
|
] );
|
|
610
|
-
if ( updateResponse&&updateResponse.answers.length>0 ) {
|
|
626
|
+
if ( updateResponse && updateResponse.answers.length > 0 ) {
|
|
611
627
|
console.log( updateResponse.answers[0] );
|
|
612
|
-
let findissuse= updateResponse.answers[0].issues.filter( ( data ) => data._id==req.body.issueId );
|
|
628
|
+
let findissuse = updateResponse.answers[0].issues.filter( ( data ) => data._id == req.body.issueId );
|
|
613
629
|
console.log( findissuse );
|
|
614
|
-
let findDetails = findissuse[0].Details.filter( ( det ) => det.status==='agree' );
|
|
630
|
+
let findDetails = findissuse[0].Details.filter( ( det ) => det.status === 'agree' );
|
|
615
631
|
console.log( '======', findDetails.length );
|
|
616
|
-
if ( findissuse[0].Details.length=== findDetails.length ) {
|
|
632
|
+
if ( findissuse[0].Details.length === findDetails.length ) {
|
|
617
633
|
await planoTaskService.updateOnefilters(
|
|
618
634
|
{ _id: new mongoose.Types.ObjectId( req.body._id ) },
|
|
619
635
|
{
|
|
@@ -626,9 +642,9 @@ export async function updateFixtureStatus( req, res ) {
|
|
|
626
642
|
}
|
|
627
643
|
let findoneplanoData = await planoTaskService.findOne( { _id: new mongoose.Types.ObjectId( req.body._id ) } );
|
|
628
644
|
console.log( '************', findoneplanoData.answers[0].issues );
|
|
629
|
-
let totalApproved= findoneplanoData.answers[0].issues.filter( ( data ) => data.status==='pending' );
|
|
645
|
+
let totalApproved = findoneplanoData.answers[0].issues.filter( ( data ) => data.status === 'pending' );
|
|
630
646
|
console.log( '---------->', totalApproved.length );
|
|
631
|
-
if ( totalApproved.length===0 ) {
|
|
647
|
+
if ( totalApproved.length === 0 ) {
|
|
632
648
|
await planoTaskService.updateOne(
|
|
633
649
|
{
|
|
634
650
|
_id: new mongoose.Types.ObjectId( req.body._id ),
|
|
@@ -640,7 +656,7 @@ export async function updateFixtureStatus( req, res ) {
|
|
|
640
656
|
}
|
|
641
657
|
}
|
|
642
658
|
|
|
643
|
-
if ( req.body.taskType==='layout' ) {
|
|
659
|
+
if ( req.body.taskType === 'layout' ) {
|
|
644
660
|
await planoTaskService.updateOnefilters(
|
|
645
661
|
{ _id: new mongoose.Types.ObjectId( req.body._id ) },
|
|
646
662
|
{
|
|
@@ -754,7 +770,7 @@ export async function updateStoreFixture( req, res ) {
|
|
|
754
770
|
export async function updateredostatus( req, res ) {
|
|
755
771
|
try {
|
|
756
772
|
console.log( '------->', req.body );
|
|
757
|
-
if ( req.body.type==='layout' ) {
|
|
773
|
+
if ( req.body.type === 'layout' ) {
|
|
758
774
|
await planoTaskService.updateOne(
|
|
759
775
|
{
|
|
760
776
|
planoId: new mongoose.Types.ObjectId( req.body.planoId ),
|
|
@@ -1329,16 +1329,18 @@ export async function getVmDetails( req, res ) {
|
|
|
1329
1329
|
getVmDetails = getVmDetails.toObject();
|
|
1330
1330
|
getVmDetails.templateCount = 0;
|
|
1331
1331
|
let templateDetails = await fixtureTemplateService.find( { 'vmConfig.vmId': { $in: req.query.vmId } } );
|
|
1332
|
-
if (
|
|
1333
|
-
getVmDetails.templateCount = templateDetails.length;
|
|
1332
|
+
if ( getVmDetails.status != 'draft' ) {
|
|
1334
1333
|
getVmDetails.status = 'inactive';
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
let
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1334
|
+
if ( templateDetails.length ) {
|
|
1335
|
+
getVmDetails.templateCount = templateDetails.length;
|
|
1336
|
+
let fixtureDetails = await storeFixtureService.find( { 'vmConfig.vmId': { $in: req.query.vmId } }, { planoId: 1 } );
|
|
1337
|
+
if ( fixtureDetails.length ) {
|
|
1338
|
+
let planoList = fixtureDetails.map( ( ele ) => ele.planoId );
|
|
1339
|
+
let planoDetails = await planoService.find( { _id: { $in: planoList } }, { status: 1 } );
|
|
1340
|
+
planoDetails = planoDetails.map( ( ele ) => ele.status );
|
|
1341
|
+
if ( planoDetails.includes( 'completed' ) ) {
|
|
1342
|
+
getVmDetails.status = 'active';
|
|
1343
|
+
}
|
|
1342
1344
|
}
|
|
1343
1345
|
}
|
|
1344
1346
|
}
|
|
@@ -3217,7 +3217,7 @@ export async function planoList( req, res ) {
|
|
|
3217
3217
|
},
|
|
3218
3218
|
{
|
|
3219
3219
|
$group: {
|
|
3220
|
-
_id: { store: '$storeName', type: '$planoType' },
|
|
3220
|
+
_id: { store: '$storeName', floorId: '$floorId', type: '$planoType' },
|
|
3221
3221
|
planoId: { $last: '$planoId' },
|
|
3222
3222
|
checklistStatus: { $last: '$checklistStatus' },
|
|
3223
3223
|
taskId: { $last: '$_id' },
|
|
@@ -3235,6 +3235,7 @@ export async function planoList( req, res ) {
|
|
|
3235
3235
|
planoId: 1,
|
|
3236
3236
|
checklistStatus: 1,
|
|
3237
3237
|
taskId: 1,
|
|
3238
|
+
floorId: '$_id.floorId',
|
|
3238
3239
|
},
|
|
3239
3240
|
},
|
|
3240
3241
|
];
|
|
@@ -3315,7 +3316,7 @@ export async function planoList( req, res ) {
|
|
|
3315
3316
|
},
|
|
3316
3317
|
{
|
|
3317
3318
|
$group: {
|
|
3318
|
-
_id: '$planoType',
|
|
3319
|
+
_id: { type: '$planoType', floorId: '$floorId' },
|
|
3319
3320
|
dateString: { $last: '$date_string' },
|
|
3320
3321
|
checklistStatus: { $last: '$checklistStatus' },
|
|
3321
3322
|
taskId: { $last: '$_id' },
|
|
@@ -3326,9 +3327,10 @@ export async function planoList( req, res ) {
|
|
|
3326
3327
|
_id: null,
|
|
3327
3328
|
taskStatus: {
|
|
3328
3329
|
$push: {
|
|
3329
|
-
type: '$_id',
|
|
3330
|
+
type: '$_id.type',
|
|
3330
3331
|
status: '$checklistStatus',
|
|
3331
3332
|
date: '$dateString',
|
|
3333
|
+
floorId: '$_id.floorId',
|
|
3332
3334
|
},
|
|
3333
3335
|
},
|
|
3334
3336
|
taskIds: { $push: '$taskId' },
|
|
@@ -3360,7 +3362,7 @@ export async function planoList( req, res ) {
|
|
|
3360
3362
|
{ $sort: { _id: -1 } },
|
|
3361
3363
|
{
|
|
3362
3364
|
$group: {
|
|
3363
|
-
_id: '$
|
|
3365
|
+
_id: '$floorId',
|
|
3364
3366
|
layoutCount: {
|
|
3365
3367
|
$sum: {
|
|
3366
3368
|
$cond: {
|
|
@@ -3539,6 +3541,35 @@ export async function planoList( req, res ) {
|
|
|
3539
3541
|
},
|
|
3540
3542
|
},
|
|
3541
3543
|
},
|
|
3544
|
+
{
|
|
3545
|
+
$group: {
|
|
3546
|
+
_id: null,
|
|
3547
|
+
layoutCount: { $sum: '$layoutCount' },
|
|
3548
|
+
fixtureCount: { $sum: '$fixtureCount' },
|
|
3549
|
+
vmCount: { $sum: '$vmCount' },
|
|
3550
|
+
completeLayout: {
|
|
3551
|
+
$sum: {
|
|
3552
|
+
$cond: {
|
|
3553
|
+
if: {
|
|
3554
|
+
$and: [
|
|
3555
|
+
{ '$gt': [ '$layoutCount', 0 ] },
|
|
3556
|
+
{ '$gt': [ '$layoutPending', 0 ] },
|
|
3557
|
+
{ '$gt': [ '$fixtureCount', 0 ] },
|
|
3558
|
+
{ '$gt': [ '$fixturePending', 0 ] },
|
|
3559
|
+
{ '$gt': [ '$vmCount', 0 ] },
|
|
3560
|
+
{ '$gt': [ '$fixturePending', 0 ] },
|
|
3561
|
+
],
|
|
3562
|
+
},
|
|
3563
|
+
then: 1,
|
|
3564
|
+
else: 0,
|
|
3565
|
+
},
|
|
3566
|
+
},
|
|
3567
|
+
},
|
|
3568
|
+
layoutPending: { $sum: '$layoutPending' },
|
|
3569
|
+
fixturePending: { $sum: '$fixturePending' },
|
|
3570
|
+
vmPending: { $sum: '$vmPending' },
|
|
3571
|
+
},
|
|
3572
|
+
},
|
|
3542
3573
|
{
|
|
3543
3574
|
$project: {
|
|
3544
3575
|
_id: 0,
|
|
@@ -3636,6 +3667,7 @@ export async function planoList( req, res ) {
|
|
|
3636
3667
|
layoutCount: 1,
|
|
3637
3668
|
fixtureCount: 1,
|
|
3638
3669
|
vmCount: 1,
|
|
3670
|
+
completeLayout: 1,
|
|
3639
3671
|
},
|
|
3640
3672
|
},
|
|
3641
3673
|
],
|
|
@@ -290,17 +290,17 @@ export async function createTask( req, res ) {
|
|
|
290
290
|
taskData.userName = userDetails.userName;
|
|
291
291
|
taskData.userEmail = userDetails.email;
|
|
292
292
|
taskData.planoId = planoDetails?._id;
|
|
293
|
-
for ( let
|
|
293
|
+
for ( let j=0; j<req.body.days; j++ ) {
|
|
294
294
|
let planoProgress = req.body.checkListName == 'Fixture Verification' ? 50 : req.body.checkListName == 'VM Verification' ? 75 : 25;
|
|
295
295
|
if ( req.body?.checkListName && req.body.checkListName == 'Layout Verification' ) {
|
|
296
|
-
let taskIdList = await planoTaskService.find( { planoId: planoDetails?._id, floorId:
|
|
296
|
+
let taskIdList = await planoTaskService.find( { planoId: planoDetails?._id, floorId: taskData.floorId } );
|
|
297
297
|
taskIdList = taskIdList.map( ( ele ) => ele.taskId );
|
|
298
|
-
await planoTaskService.deleteMany( { planoId: planoDetails?._id, floorId:
|
|
298
|
+
await planoTaskService.deleteMany( { planoId: planoDetails?._id, floorId: taskData.floorId } );
|
|
299
299
|
planoProgress = 25;
|
|
300
300
|
await processedService.deleteMany( { _id: taskIdList } );
|
|
301
301
|
}
|
|
302
302
|
await planoService.updateOne( { _id: planoDetails?._id }, { $set: { planoProgress } } );
|
|
303
|
-
let currDate = dayjs().add(
|
|
303
|
+
let currDate = dayjs().add( j, 'day' );
|
|
304
304
|
let insertData = { ...taskData, date_string: currDate.format( 'YYYY-MM-DD' ), date_iso: new Date( currDate.format( 'YYYY-MM-DD' ) ), scheduleStartTime_iso: dayjs.utc( `${currDate.format( 'YYYY-MM-DD' )} 12:00 AM`, 'YYYY-MM-DD hh:mm A' ).format() };
|
|
305
305
|
await processedService.updateOne( { date_string: currDate.format( 'YYYY-MM-DD' ), store_id: insertData.store_id, userEmail: insertData.userEmail, planoId: insertData.planoId, sourceCheckList_id: task._id, ...( taskData?.floorId ) ? { floorId: taskData.floorId }:{} }, insertData );
|
|
306
306
|
}
|