tango-app-api-trax 3.5.0-alpha-2 → 3.5.1-alpha-0
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 +1 -1
- package/src/controllers/download.controller.js +9 -9
- package/src/controllers/gallery.controller.js +5 -5
- package/src/controllers/internalTrax.controller.js +4 -4
- package/src/controllers/mobileTrax.controller.js +33 -33
- package/src/controllers/teaxFlag.controller.js +2 -2
- package/src/controllers/trax.controller.js +13 -2
package/package.json
CHANGED
|
@@ -43,7 +43,7 @@ export const downloadInsert = async ( req, res ) => {
|
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
console.log( requestData );
|
|
46
|
+
// console.log( requestData );
|
|
47
47
|
|
|
48
48
|
if ( requestData.sourceCheckList_id && requestData.sourceCheckList_id != '' ) {
|
|
49
49
|
let getChecklistQuery = [];
|
|
@@ -64,7 +64,7 @@ export const downloadInsert = async ( req, res ) => {
|
|
|
64
64
|
},
|
|
65
65
|
} );
|
|
66
66
|
} else {
|
|
67
|
-
console.log( requestData );
|
|
67
|
+
// console.log( requestData );
|
|
68
68
|
getChecklistQuery.push( {
|
|
69
69
|
$match: {
|
|
70
70
|
$and: [
|
|
@@ -82,7 +82,7 @@ export const downloadInsert = async ( req, res ) => {
|
|
|
82
82
|
getChecklistQuery.push( { $count: 'totalCount' } );
|
|
83
83
|
|
|
84
84
|
let getChecklistCount = await processedchecklistService.aggregate( getChecklistQuery );
|
|
85
|
-
console.log( getChecklistCount );
|
|
85
|
+
// console.log( getChecklistCount );
|
|
86
86
|
if ( requestData.insertType === 'task' ) {
|
|
87
87
|
getChecklistCount = await processedTaskService.aggregate( getChecklistQuery );
|
|
88
88
|
}
|
|
@@ -146,7 +146,7 @@ export const downloadInsert = async ( req, res ) => {
|
|
|
146
146
|
'filtertype': requestData.filtertype || 'Clusters',
|
|
147
147
|
'checkListType': requestData.checkListType,
|
|
148
148
|
};
|
|
149
|
-
console.log( insertData );
|
|
149
|
+
// console.log( insertData );
|
|
150
150
|
let resultData = await downloadService.insert( insertData );
|
|
151
151
|
if ( resultData ) {
|
|
152
152
|
let sqsMessageRequestData = {
|
|
@@ -201,7 +201,7 @@ export const downloadInsertAI = async ( req, res ) => {
|
|
|
201
201
|
name = requestData?.checklistName;
|
|
202
202
|
}
|
|
203
203
|
let findchecklist = await processedcheklistconfigService.findOne( { 'checkListType': requestData.checkListType, 'client_id': requestData.clientId } ).sort( { _id: -1 } );
|
|
204
|
-
console.log( findchecklist );
|
|
204
|
+
// console.log( findchecklist );
|
|
205
205
|
name = name + '-' + requestData.fileType;
|
|
206
206
|
let insertData = {
|
|
207
207
|
'date_string': requestData.fromDate || '',
|
|
@@ -232,10 +232,10 @@ export const downloadInsertAI = async ( req, res ) => {
|
|
|
232
232
|
'checkListName': findchecklist.checkListName,
|
|
233
233
|
'checkListDescription': findchecklist.checkListDescription,
|
|
234
234
|
};
|
|
235
|
-
console.log( requestData );
|
|
236
|
-
console.log( insertData );
|
|
235
|
+
// console.log( requestData );
|
|
236
|
+
// console.log( insertData );
|
|
237
237
|
let resultData = await downloadService.insert( insertData );
|
|
238
|
-
console.log( resultData );
|
|
238
|
+
// console.log( resultData );
|
|
239
239
|
if ( resultData ) {
|
|
240
240
|
let sqsMessageRequestData = {
|
|
241
241
|
'zipId': resultData._id,
|
|
@@ -588,7 +588,7 @@ export const getAiChecklistDataFromZipId = async ( req, res ) => {
|
|
|
588
588
|
brandInfo.brandLogo = getzipdata.client_id + '/logo/' + getClientData.profileDetails.logo;
|
|
589
589
|
}
|
|
590
590
|
getzipdata.brandInfo = brandInfo;
|
|
591
|
-
console.log( getzipdata );
|
|
591
|
+
// console.log( getzipdata );
|
|
592
592
|
return res.sendSuccess( getzipdata );
|
|
593
593
|
} else {
|
|
594
594
|
return res.sendError( { error: 'No Data Found' }, 204 );
|
|
@@ -355,7 +355,7 @@ export async function approveChecklist( req, res ) {
|
|
|
355
355
|
console.log( 'logData', logData );
|
|
356
356
|
let urlopensearch = JSON.parse( process.env.OPENSEARCH );
|
|
357
357
|
insertOpenSearchData( urlopensearch.traxActivityLog, logData );
|
|
358
|
-
console.log( searchResponse.ok );
|
|
358
|
+
// console.log( searchResponse.ok );
|
|
359
359
|
if ( searchResponse.ok ) {
|
|
360
360
|
let pendingstores = checklistDetails.filter( ( data ) => data.checklistStatus != 'submit' );
|
|
361
361
|
if ( pendingstores && pendingstores.length > 0 ) {
|
|
@@ -439,7 +439,7 @@ export async function redoChecklist( req, res ) {
|
|
|
439
439
|
};
|
|
440
440
|
|
|
441
441
|
let response = await processedChecklist.updateOne( { _id: req.body.payload._id }, updateData );
|
|
442
|
-
console.log( response );
|
|
442
|
+
// console.log( response );
|
|
443
443
|
if ( response.modifiedCount || response.matchedCount ) {
|
|
444
444
|
let storeTimeZone = await storeService.findOne( { storeName: checklistDetails.storeName }, { 'storeProfile.timeZone': 1 } );
|
|
445
445
|
let currentDateTime;
|
|
@@ -479,7 +479,7 @@ export async function redoChecklist( req, res ) {
|
|
|
479
479
|
};
|
|
480
480
|
let url = JSON.parse( process.env.LAMBDAURL );
|
|
481
481
|
let searchResponse = await fetch( url.redoChecklist, requestOptions );
|
|
482
|
-
console.log( searchResponse.ok );
|
|
482
|
+
// console.log( searchResponse.ok );
|
|
483
483
|
let logData= {
|
|
484
484
|
'client_id': checklistDetails.client_id,
|
|
485
485
|
'createAt': new Date(),
|
|
@@ -581,7 +581,7 @@ export async function redomultiChecklist( req, res ) {
|
|
|
581
581
|
};
|
|
582
582
|
|
|
583
583
|
let response = await processedChecklist.updateOne( { _id: originalData.checklistId }, updateData );
|
|
584
|
-
console.log( response );
|
|
584
|
+
// console.log( response );
|
|
585
585
|
if ( response.modifiedCount || response.matchedCount ) {
|
|
586
586
|
let storeTimeZone = await storeService.findOne( { storeName: checklistDetails.storeName }, { 'storeProfile.timeZone': 1 } );
|
|
587
587
|
let currentDateTime;
|
|
@@ -616,7 +616,7 @@ export async function redomultiChecklist( req, res ) {
|
|
|
616
616
|
req.body.payload._id=originalData.checklistId;
|
|
617
617
|
req.body.payload.section_id=originalData.section_id;
|
|
618
618
|
req.body.payload.uniqueNo=originalData.uniqueNo;
|
|
619
|
-
console.log( req.body );
|
|
619
|
+
// console.log( req.body );
|
|
620
620
|
|
|
621
621
|
|
|
622
622
|
const requestOptions = {
|
|
@@ -2013,15 +2013,15 @@ export async function getPDFCSVChecklistDetails( req, res ) {
|
|
|
2013
2013
|
|
|
2014
2014
|
export async function AiPushNotificationAlert( req, res ) {
|
|
2015
2015
|
try {
|
|
2016
|
-
console.log( req.body );
|
|
2016
|
+
// console.log( req.body );
|
|
2017
2017
|
let findAichecklist = await PCLconfig.findOne( { checkListType: req.body.checkListType, client_id: req.body.clientId, date_string: req.body.Date }, { aiConfig: 1 } );
|
|
2018
2018
|
if ( findAichecklist.aiConfig&&findAichecklist.aiConfig.alerts&&findAichecklist.aiConfig.alerts.users&&findAichecklist.aiConfig.alerts.users.length>0 ) {
|
|
2019
|
-
console.log( findAichecklist.aiConfig.alerts.users );
|
|
2019
|
+
// console.log( findAichecklist.aiConfig.alerts.users );
|
|
2020
2020
|
for ( let user of findAichecklist.aiConfig.alerts.users ) {
|
|
2021
2021
|
let findOneUser = await userService.findOne( { email: user }, { fcmToken: 1 } );
|
|
2022
|
-
console.log( findOneUser );
|
|
2022
|
+
// console.log( findOneUser );
|
|
2023
2023
|
if ( findOneUser&&findOneUser.fcmToken&&findOneUser.fcmToken!='' ) {
|
|
2024
|
-
console.log( findOneUser.fcmToken );
|
|
2024
|
+
// console.log( findOneUser.fcmToken );
|
|
2025
2025
|
try {
|
|
2026
2026
|
await sendPushNotification( req.body.title, req.body.description, findOneUser.fcmToken );
|
|
2027
2027
|
} catch ( e ) {
|
|
@@ -591,47 +591,47 @@ export async function sopMobilechecklistQuestionValidatorv1( req, res, next ) {
|
|
|
591
591
|
return res.sendError( 'Please Fill all Required Fields', 400 );
|
|
592
592
|
}
|
|
593
593
|
|
|
594
|
-
if ( requestData.submittype == 'submit' ) {
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
594
|
+
// if ( requestData.submittype == 'submit' ) {
|
|
595
|
+
let reqAnswers = requestData.questionAnswers;
|
|
596
|
+
logger.error( { functionName: 'payload', message: reqAnswers } );
|
|
597
|
+
let CLQAnswers = getChecklistQA.questionAnswers;
|
|
598
|
+
logger.error( { functionName: 'CLQAnswers', message: CLQAnswers } );
|
|
599
|
+
let validationCount= 0;
|
|
600
|
+
let errorCount = 0;
|
|
601
|
+
CLQAnswers.forEach( ( section ) => {
|
|
602
|
+
let requestSection = reqAnswers.filter( ( reqSection ) => reqSection.sectionName == section?.sectionOldName || reqSection.sectionName == section?.sectionName );
|
|
603
|
+
if ( requestSection.length ) {
|
|
604
|
+
requestSection.forEach( ( item ) => item.section_id = section.section_id );
|
|
605
|
+
section.questions.forEach( ( question ) => {
|
|
606
|
+
// question.answers.forEach( ( answer ) => {
|
|
607
|
+
let sectionQuestion = requestSection.filter( ( secQuestion ) => secQuestion.qname == question.oldQname || secQuestion.qname == question.qname );
|
|
608
|
+
if ( sectionQuestion.length ) {
|
|
609
|
+
if ( question.answerType == 'multiplechoicemultiple' && ( sectionQuestion[0].Multianswer == null || sectionQuestion[0].Multianswer == '' || !sectionQuestion[0].Multianswer.length ) ) {
|
|
610
|
+
validationCount++;
|
|
611
|
+
} else {
|
|
612
|
+
if ( ![ 'multiplechoicemultiple', 'multipleImage' ].includes( question.answerType ) && ( ( !sectionQuestion[0].linkType && ( sectionQuestion[0].answer == null || sectionQuestion[0].answer == '' ) ) || ( sectionQuestion[0].linkType && sectionQuestion[0].linkquestionenabled && ( sectionQuestion[0].answer == null || sectionQuestion[0].answer == '' ) ) ) ) {
|
|
610
613
|
validationCount++;
|
|
611
|
-
} else {
|
|
612
|
-
if ( ![ 'multiplechoicemultiple', 'multipleImage' ].includes( question.answerType ) && ( ( !sectionQuestion[0].linkType && ( sectionQuestion[0].answer == null || sectionQuestion[0].answer == '' ) ) || ( sectionQuestion[0].linkType && sectionQuestion[0].linkquestionenabled && ( sectionQuestion[0].answer == null || sectionQuestion[0].answer == '' ) ) ) ) {
|
|
613
|
-
validationCount++;
|
|
614
|
-
}
|
|
615
614
|
}
|
|
616
|
-
} else {
|
|
617
|
-
errorCount++;
|
|
618
615
|
}
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
}
|
|
624
|
-
} );
|
|
625
|
-
if ( validationCount ) {
|
|
626
|
-
return res.sendError( 'Please Fill all Required Fields', 400 );
|
|
627
|
-
} else if ( errorCount ) {
|
|
628
|
-
return res.sendError( 'Checklist got edited.please contact admin', 400 );
|
|
616
|
+
} else {
|
|
617
|
+
errorCount++;
|
|
618
|
+
}
|
|
619
|
+
// } );
|
|
620
|
+
} );
|
|
629
621
|
} else {
|
|
630
|
-
|
|
622
|
+
errorCount++;
|
|
631
623
|
}
|
|
624
|
+
} );
|
|
625
|
+
if ( validationCount && requestData.submittype == 'submit' ) {
|
|
626
|
+
return res.sendError( 'Please Fill all Required Fields', 400 );
|
|
627
|
+
} else if ( errorCount ) {
|
|
628
|
+
return res.sendError( 'Checklist got edited.please contact admin', 400 );
|
|
632
629
|
} else {
|
|
633
630
|
next();
|
|
634
631
|
}
|
|
632
|
+
// } else {
|
|
633
|
+
// next();
|
|
634
|
+
// }
|
|
635
635
|
} catch ( e ) {
|
|
636
636
|
logger.error( { function: 'sopMobilechecklistQuestionValidator', error: e, body: req.body } );
|
|
637
637
|
return res.sendError( e, 500 );
|
|
@@ -2493,7 +2493,7 @@ export const flagChecklistTableV1 = async ( req, res ) => {
|
|
|
2493
2493
|
if ( resultData ) {
|
|
2494
2494
|
if ( resultData.status_code == '200' ) {
|
|
2495
2495
|
const exportdata = [];
|
|
2496
|
-
console.log( resultData );
|
|
2496
|
+
// console.log( resultData );
|
|
2497
2497
|
if ( reqestData.ChecklistType==='scrum'||reqestData.ChecklistType==='cleaning' ) {
|
|
2498
2498
|
reqestData.ChecklistType = 'scrumdetection';
|
|
2499
2499
|
}
|
|
@@ -2515,7 +2515,7 @@ export const flagChecklistTableV1 = async ( req, res ) => {
|
|
|
2515
2515
|
return res.sendError( 'No Content', 204 );
|
|
2516
2516
|
}
|
|
2517
2517
|
}
|
|
2518
|
-
console.log( reqestData );
|
|
2518
|
+
// console.log( reqestData );
|
|
2519
2519
|
|
|
2520
2520
|
let LamdaURL = 'https://bnauly42yuztzrgtttodzt3bcm0oqrsi.lambda-url.ap-south-1.on.aws/';
|
|
2521
2521
|
let resultData = await LamdaServiceCall( LamdaURL, reqestData );
|
|
@@ -3720,7 +3720,18 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
|
|
|
3720
3720
|
date_iso: insertdata.date_iso,
|
|
3721
3721
|
client_id: insertdata.client_id,
|
|
3722
3722
|
checkListId: updatedchecklist._id,
|
|
3723
|
-
checklistStatus: 'inprogress',
|
|
3723
|
+
// checklistStatus: 'inprogress',
|
|
3724
|
+
$or: [
|
|
3725
|
+
{
|
|
3726
|
+
$and: [
|
|
3727
|
+
{ checklistStatus: 'open' },
|
|
3728
|
+
{ redoStatus: 'true' },
|
|
3729
|
+
],
|
|
3730
|
+
},
|
|
3731
|
+
{
|
|
3732
|
+
checklistStatus: 'inprogress',
|
|
3733
|
+
},
|
|
3734
|
+
],
|
|
3724
3735
|
}, { userId: 1, store_id: 1 } );
|
|
3725
3736
|
|
|
3726
3737
|
if ( inprogressData.length ) {
|
|
@@ -3739,7 +3750,7 @@ async function insertPCBulkV4( getCLconfig, checklistId, currentdate, updatedche
|
|
|
3739
3750
|
}
|
|
3740
3751
|
|
|
3741
3752
|
if ( deletedList.length ) {
|
|
3742
|
-
await processedchecklist.deleteMany( { date_string: insertdata.date_string, date_iso: insertdata.date_iso, client_id: insertdata.client_id, checkListId: updatedchecklist._id, _id: { $in: deletedList } } );
|
|
3753
|
+
await processedchecklist.deleteMany( { date_string: insertdata.date_string, date_iso: insertdata.date_iso, client_id: insertdata.client_id, checkListId: updatedchecklist._id, _id: { $in: deletedList }, redoStatus: false } );
|
|
3743
3754
|
}
|
|
3744
3755
|
await processedchecklist.insertMany( assignUserList );
|
|
3745
3756
|
actionType = 'insertAssignUsers';
|