tango-app-api-trax 3.3.1-beta-5 → 3.3.1-beta-7
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-trax",
|
|
3
|
-
"version": "3.3.1-beta-
|
|
3
|
+
"version": "3.3.1-beta-7",
|
|
4
4
|
"description": "Trax",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"mongodb": "^6.8.0",
|
|
27
27
|
"nodemon": "^3.1.4",
|
|
28
28
|
"path": "^0.12.7",
|
|
29
|
-
"tango-api-schema": "^2.2.
|
|
29
|
+
"tango-api-schema": "^2.2.35",
|
|
30
30
|
"tango-app-api-middleware": "^3.1.50",
|
|
31
31
|
"url": "^0.11.4",
|
|
32
32
|
"winston": "^3.13.1",
|
|
@@ -19,6 +19,7 @@ import utc from 'dayjs/plugin/utc.js';
|
|
|
19
19
|
import { logger } from 'tango-app-api-middleware';
|
|
20
20
|
import mongoose from 'mongoose';
|
|
21
21
|
import { sendPushNotification } from 'tango-app-api-middleware';
|
|
22
|
+
import * as planoService from '../services/planogram.service.js';
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
const ObjectId = mongoose.Types.ObjectId;
|
|
@@ -416,6 +417,11 @@ async function insertData( requestData ) {
|
|
|
416
417
|
element4.scheduleRepeatedType = getCLconfig.scheduleRepeatedType;
|
|
417
418
|
element4.approvalEnable = getCLconfig.approver.length ? true : false;
|
|
418
419
|
element4.remainder = getCLconfig?.remainder || [];
|
|
420
|
+
if ( getCLconfig?.isPlano ) {
|
|
421
|
+
let planoDetails = await planoService.findOne( { storeId: element4.store_id, clientId: getCLconfig.client_id }, { _id: 1 } );
|
|
422
|
+
element4.planoId = planoDetails?._id;
|
|
423
|
+
element4.isPlano = getCLconfig?.isPlano;
|
|
424
|
+
}
|
|
419
425
|
}
|
|
420
426
|
if ( userIdList.length ) {
|
|
421
427
|
allQuestion = allQuestion.filter( ( item ) => typeof item._id == 'undefined' );
|
|
@@ -698,6 +698,7 @@ export async function sopMobilechecklistMultiSectionFormatter( req, res, next )
|
|
|
698
698
|
structure.parentanswer = requestSection[i].parentanswer;
|
|
699
699
|
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
700
700
|
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
701
|
+
structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
701
702
|
if ( qaAnswers[j]?.taskId ) {
|
|
702
703
|
structure.taskId = qaAnswers[j]?.taskId;
|
|
703
704
|
structure.task = true;
|
|
@@ -749,6 +750,7 @@ export async function sopMobilechecklistMultiSectionFormatter( req, res, next )
|
|
|
749
750
|
structure.parentanswer = requestSection[i].parentanswer;
|
|
750
751
|
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
751
752
|
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
753
|
+
structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
752
754
|
if ( qaAnswers[j]?.taskId ) {
|
|
753
755
|
structure.taskId = qaAnswers[j]?.taskId;
|
|
754
756
|
structure.task = true;
|
|
@@ -804,6 +806,7 @@ export async function sopMobilechecklistMultiSectionFormatter( req, res, next )
|
|
|
804
806
|
structure.parentanswer = requestSection[i].parentanswer;
|
|
805
807
|
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
806
808
|
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
809
|
+
structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
807
810
|
if ( qaAnswers[j]?.taskId ) {
|
|
808
811
|
structure.taskId = qaAnswers[j]?.taskId;
|
|
809
812
|
structure.task = true;
|
|
@@ -864,6 +867,7 @@ export async function sopMobilechecklistMultiSectionFormatter( req, res, next )
|
|
|
864
867
|
structure.parentanswer = requestSection[i].parentanswer;
|
|
865
868
|
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
866
869
|
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
870
|
+
structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
867
871
|
if ( qaAnswers[j]?.taskId ) {
|
|
868
872
|
structure.taskId = qaAnswers[j]?.taskId;
|
|
869
873
|
structure.task = true;
|
|
@@ -922,6 +926,7 @@ export async function sopMobilechecklistMultiSectionFormatter( req, res, next )
|
|
|
922
926
|
structure.parentanswer = requestSection[i].parentanswer;
|
|
923
927
|
structure.questionReferenceImage = qaAnswers[j].questionReferenceImage;
|
|
924
928
|
structure.descriptivetype = qaAnswers[j].descriptivetype;
|
|
929
|
+
structure.parentQuestion = requestSection[i]?.parentQuestion || qaAnswers[j].qno;
|
|
925
930
|
if ( qaAnswers[j]?.taskId ) {
|
|
926
931
|
structure.taskId = qaAnswers[j]?.taskId;
|
|
927
932
|
structure.task = true;
|
|
@@ -2340,7 +2345,7 @@ export async function checklistv1( req, res ) {
|
|
|
2340
2345
|
const { store_id, date, checklistStatus, searchValue } = req.query;
|
|
2341
2346
|
const userId = req.user._id;
|
|
2342
2347
|
|
|
2343
|
-
const buildPipeline = ( matchExtraConditions = [],
|
|
2348
|
+
const buildPipeline = ( matchExtraConditions = [], projectExtraConditions = {} ) => {
|
|
2344
2349
|
const matchConditions = [
|
|
2345
2350
|
// eslint-disable-next-line camelcase
|
|
2346
2351
|
{ store_id },
|
|
@@ -2388,6 +2393,7 @@ export async function checklistv1( req, res ) {
|
|
|
2388
2393
|
redoStatus: { $ifNull: [ '$redoStatus', false ] },
|
|
2389
2394
|
type: { $ifNull: [ '$checkListType', '' ] },
|
|
2390
2395
|
priorityType: { $ifNull: [ '$priorityType', '' ] },
|
|
2396
|
+
...projectExtraConditions,
|
|
2391
2397
|
},
|
|
2392
2398
|
},
|
|
2393
2399
|
];
|
|
@@ -2396,8 +2402,8 @@ export async function checklistv1( req, res ) {
|
|
|
2396
2402
|
};
|
|
2397
2403
|
|
|
2398
2404
|
const [ checklistResult, taskResult ] = await Promise.allSettled( [
|
|
2399
|
-
processedchecklist.aggregate( buildPipeline( [ { checkListType: 'custom' } ],
|
|
2400
|
-
processedTask.aggregate( buildPipeline( [],
|
|
2405
|
+
processedchecklist.aggregate( buildPipeline( [ { checkListType: 'custom' } ], { isPlano: 1, planoId: 1 } ) ),
|
|
2406
|
+
processedTask.aggregate( buildPipeline( [], { isPlano: 1, planoId: 1 } ) ),
|
|
2401
2407
|
] );
|
|
2402
2408
|
|
|
2403
2409
|
const checklistData = checklistResult.status === 'fulfilled' ? checklistResult.value : [];
|
|
@@ -3334,3 +3340,24 @@ export async function clientConfig( req, res ) {
|
|
|
3334
3340
|
return res.sendError( e, 500 );
|
|
3335
3341
|
}
|
|
3336
3342
|
}
|
|
3343
|
+
|
|
3344
|
+
export async function updatePlanoStatus( req, res ) {
|
|
3345
|
+
try {
|
|
3346
|
+
if ( !req.body.id ) {
|
|
3347
|
+
return res.sendError( 'Processed checklist id is required' );
|
|
3348
|
+
}
|
|
3349
|
+
if ( !req.body.status ) {
|
|
3350
|
+
return res.sendError( 'status is required' );
|
|
3351
|
+
}
|
|
3352
|
+
let processCheckDetails = await processedchecklist.findOne( { _id: req.body.id } );
|
|
3353
|
+
if ( !processCheckDetails ) {
|
|
3354
|
+
return res.sendError( 'No data found', 204 );
|
|
3355
|
+
}
|
|
3356
|
+
processCheckDetails.checklistStatus = req.body.status;
|
|
3357
|
+
processCheckDetails.save();
|
|
3358
|
+
return res.sendSuccess( 'Status updated Successfully' );
|
|
3359
|
+
} catch ( e ) {
|
|
3360
|
+
logger.error( { error: e, function: 'updatePlanoStatus' } );
|
|
3361
|
+
return res.sendError( e, 500 );
|
|
3362
|
+
}
|
|
3363
|
+
}
|
|
@@ -25,5 +25,6 @@ mobileRouter
|
|
|
25
25
|
.post( '/verifylocation', isAllowedSessionHandler, mobileController.getStoreLocation, mobileController.location )
|
|
26
26
|
.post( '/login', mobileController.login )
|
|
27
27
|
.post( '/checkUpdateVersion', mobileController.checkVersion )
|
|
28
|
-
.post( '/checkClientConfig', isAllowedSessionHandler, mobileController.clientConfig )
|
|
28
|
+
.post( '/checkClientConfig', isAllowedSessionHandler, mobileController.clientConfig )
|
|
29
|
+
.post( '/updatePlanoStatus', isAllowedSessionHandler, mobileController.updatePlanoStatus );
|
|
29
30
|
|