tango-app-api-store-builder 1.0.0-beta-146 → 1.0.0-beta-148
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-148",
|
|
4
4
|
"description": "storeBuilder",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"path": "^0.12.7",
|
|
33
33
|
"selenium-webdriver": "^4.31.0",
|
|
34
34
|
"sharp": "^0.34.1",
|
|
35
|
-
"tango-api-schema": "^2.2.
|
|
35
|
+
"tango-api-schema": "^2.2.191",
|
|
36
36
|
"tango-app-api-middleware": "3.1.48",
|
|
37
37
|
"url": "^0.11.4",
|
|
38
38
|
"winston": "^3.17.0",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as floorService from '../service/storeBuilder.service.js';
|
|
2
|
-
import { logger } from 'tango-app-api-middleware';
|
|
2
|
+
import { logger, insertOpenSearchData } from 'tango-app-api-middleware';
|
|
3
3
|
// import * as storeService from '../service/store.service.js';
|
|
4
4
|
import * as planoService from '../service/planogram.service.js';
|
|
5
5
|
import * as storeFixtureService from '../service/storeFixture.service.js';
|
|
@@ -302,8 +302,6 @@ function buildPipelineByType( type, planoId, floorId, filterByStatus, filterByAp
|
|
|
302
302
|
},
|
|
303
303
|
},
|
|
304
304
|
},
|
|
305
|
-
|
|
306
|
-
|
|
307
305
|
);
|
|
308
306
|
} else {
|
|
309
307
|
pipeline.push(
|
|
@@ -679,12 +677,7 @@ export async function updateFixtureStatus( req, res ) {
|
|
|
679
677
|
if ( vmTask.length>0 ) {
|
|
680
678
|
let allTaskDone = vmTask.filter( ( data ) => data.status === 'incomplete' );
|
|
681
679
|
if ( allTaskDone.length === 0 ) {
|
|
682
|
-
await
|
|
683
|
-
{
|
|
684
|
-
_id: new mongoose.Types.ObjectId( req.body.planoId ),
|
|
685
|
-
},
|
|
686
|
-
{ $set: { planoProgress: 100 } },
|
|
687
|
-
);
|
|
680
|
+
await floorService.updateOne( { _id: taskData?.floorId }, { planoProgress: 100 } );
|
|
688
681
|
}
|
|
689
682
|
}
|
|
690
683
|
res.sendSuccess( 'updated successfully' );
|
|
@@ -814,7 +807,7 @@ export async function updateredostatus( req, res ) {
|
|
|
814
807
|
|
|
815
808
|
export async function updateGlobalComment( req, res ) {
|
|
816
809
|
try {
|
|
817
|
-
|
|
810
|
+
let payload ={
|
|
818
811
|
userId: req.user._id,
|
|
819
812
|
userName: req.user.userName,
|
|
820
813
|
comment: req.body.comment,
|
|
@@ -823,7 +816,9 @@ export async function updateGlobalComment( req, res ) {
|
|
|
823
816
|
floorId: new mongoose.Types.ObjectId( req.body.floorId ),
|
|
824
817
|
taskType: req.body.taskType,
|
|
825
818
|
clientId: req.body.clientId,
|
|
826
|
-
}
|
|
819
|
+
};
|
|
820
|
+
await planoGlobalCommentService.create( payload );
|
|
821
|
+
await insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).planoglobalcomments, payload );
|
|
827
822
|
|
|
828
823
|
res.sendSuccess( 'updated successfully' );
|
|
829
824
|
} catch ( e ) {
|
|
@@ -838,6 +833,8 @@ export async function getGlobalComment( req, res ) {
|
|
|
838
833
|
floorId: new mongoose.Types.ObjectId( req.body.floorId ),
|
|
839
834
|
taskType: req.body.taskType,
|
|
840
835
|
} );
|
|
836
|
+
|
|
837
|
+
|
|
841
838
|
res.sendSuccess( layoutComment );
|
|
842
839
|
} catch ( e ) {
|
|
843
840
|
logger.error( { functionName: 'getGlobalComment', error: e } );
|
|
@@ -2645,7 +2645,7 @@ export async function storeFixturesv2( req, res ) {
|
|
|
2645
2645
|
{ storeId: { $in: req.body.id } },
|
|
2646
2646
|
],
|
|
2647
2647
|
},
|
|
2648
|
-
{ storeId: 1, storeName: 1, planoId: '$_id', productResolutionLevel: 1, scanType: 1, clientId: 1, validateShelfSections: 1
|
|
2648
|
+
{ storeId: 1, storeName: 1, planoId: '$_id', productResolutionLevel: 1, scanType: 1, clientId: 1, validateShelfSections: 1 },
|
|
2649
2649
|
);
|
|
2650
2650
|
|
|
2651
2651
|
if ( !planograms?.length ) return res.sendError( 'No data found', 204 );
|
|
@@ -3267,12 +3267,12 @@ export async function planoList( req, res ) {
|
|
|
3267
3267
|
{
|
|
3268
3268
|
$lookup: {
|
|
3269
3269
|
from: 'storefixtures',
|
|
3270
|
-
let: {
|
|
3270
|
+
let: { floor: '$layout.id' },
|
|
3271
3271
|
pipeline: [
|
|
3272
3272
|
{
|
|
3273
3273
|
$match: {
|
|
3274
3274
|
$expr: {
|
|
3275
|
-
$eq: [ '$
|
|
3275
|
+
$eq: [ '$floorId', '$$floor' ],
|
|
3276
3276
|
},
|
|
3277
3277
|
},
|
|
3278
3278
|
},
|
|
@@ -3367,19 +3367,6 @@ export async function planoList( req, res ) {
|
|
|
3367
3367
|
},
|
|
3368
3368
|
},
|
|
3369
3369
|
{ $sort: { _id: -1 } },
|
|
3370
|
-
{
|
|
3371
|
-
$group: {
|
|
3372
|
-
_id: { floorId: '$floorId', type: '$type' },
|
|
3373
|
-
doc: { $first: '$$ROOT' },
|
|
3374
|
-
},
|
|
3375
|
-
},
|
|
3376
|
-
{
|
|
3377
|
-
$project: {
|
|
3378
|
-
type: '$_id.type',
|
|
3379
|
-
floorId: '$_id.floorId',
|
|
3380
|
-
answers: '$doc.answers',
|
|
3381
|
-
},
|
|
3382
|
-
},
|
|
3383
3370
|
{
|
|
3384
3371
|
$set: {
|
|
3385
3372
|
hasPendingIssues: {
|
|
@@ -3952,7 +3939,6 @@ export async function planoList( req, res ) {
|
|
|
3952
3939
|
];
|
|
3953
3940
|
|
|
3954
3941
|
let pendingDetails = await planotaskService.aggregate( taskQuery );
|
|
3955
|
-
|
|
3956
3942
|
taskQuery = [
|
|
3957
3943
|
{
|
|
3958
3944
|
$match: {
|
|
@@ -4074,6 +4060,7 @@ export async function planoList( req, res ) {
|
|
|
4074
4060
|
];
|
|
4075
4061
|
|
|
4076
4062
|
pendingDetails = await planoTaskComplianceService.aggregate( taskQuery );
|
|
4063
|
+
// console.log( JSON.stringify( pendingDetails ) );
|
|
4077
4064
|
let result = {
|
|
4078
4065
|
data: planoDetails[0].data,
|
|
4079
4066
|
count: planoDetails?.[0]?.count?.[0]?.total || 0,
|
|
@@ -4541,11 +4528,11 @@ export async function getTaskDetails( req, res ) {
|
|
|
4541
4528
|
|
|
4542
4529
|
let taskInfo = await planotaskService.aggregate( query );
|
|
4543
4530
|
let disabledInfo = [];
|
|
4544
|
-
let floorDetails = await layoutService.findOne( { _id: req.query.floorId }, { isEdited: 1 } );
|
|
4531
|
+
let floorDetails = await layoutService.findOne( { _id: req.query.floorId }, { isEdited: 1, planoProgress: 1 } );
|
|
4545
4532
|
if ( floorDetails && !floorDetails?.isEdited ) {
|
|
4546
4533
|
disabledInfo = taskInfo?.[0]?.taskStatus?.filter( ( ele ) => ( ( ele.feedbackStatus && ![ 'complete', 'disagree' ].includes( ele.feedbackStatus ) ) || ele.status != 'submit' ) && !ele?.breach );
|
|
4547
4534
|
}
|
|
4548
|
-
return res.sendSuccess( { taskDetails: taskInfo?.[0]?.taskStatus, disabled: disabledInfo?.length ? true : false } );
|
|
4535
|
+
return res.sendSuccess( { taskDetails: taskInfo?.[0]?.taskStatus, disabled: disabledInfo?.length ? true : false, planoProgress: floorDetails?.planoProgress ?? 25 } );
|
|
4549
4536
|
} catch ( e ) {
|
|
4550
4537
|
logger.error( { functionName: 'getTaskDetails', error: e } );
|
|
4551
4538
|
return res.sendError( e, 500 );
|
|
@@ -306,7 +306,7 @@ export async function createTask( req, res ) {
|
|
|
306
306
|
let type = req.body.checkListName == 'Fixture Verification' ? 'fixture' :'vm';
|
|
307
307
|
await planoTaskService.deleteMany( { planoId: planoDetails?._id, floorId: taskData?.floorId, type: type } );
|
|
308
308
|
}
|
|
309
|
-
await
|
|
309
|
+
await floorService.updateOne( { _id: taskData?.floorId }, { planoProgress } );
|
|
310
310
|
for ( let j=0; j<req.body.days; j++ ) {
|
|
311
311
|
let currDate = dayjs().add( j, 'day' );
|
|
312
312
|
let time = '12:00 AM';
|
|
@@ -632,7 +632,20 @@ export async function updateAnswersv2( req, res ) {
|
|
|
632
632
|
}
|
|
633
633
|
|
|
634
634
|
await insertOpenSearchData( JSON.parse( process.env.OPENSEARCH ).planotaskcompliances, data );
|
|
635
|
+
let vmTask = await planoTaskService.find(
|
|
636
|
+
{
|
|
637
|
+
planoId: new mongoose.Types.ObjectId( req.body.planoId ),
|
|
638
|
+
floorId: new mongoose.Types.ObjectId( req.body.floorId ),
|
|
639
|
+
type: 'vm',
|
|
640
|
+
},
|
|
635
641
|
|
|
642
|
+
);
|
|
643
|
+
if ( vmTask.length>0 ) {
|
|
644
|
+
let allTaskDone = vmTask.filter( ( data ) => data.status === 'incomplete' );
|
|
645
|
+
if ( allTaskDone.length === 0 ) {
|
|
646
|
+
await floorService.updateOne( { _id: taskData?.floorId }, { planoProgress: 100 } );
|
|
647
|
+
}
|
|
648
|
+
}
|
|
636
649
|
return res.sendSuccess( 'Fixture details updated successfully' );
|
|
637
650
|
} catch ( e ) {
|
|
638
651
|
logger.error( { functionName: 'updateAnswers', error: e } );
|