tango-app-api-trax 3.9.24 → 3.9.26
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/index.js
CHANGED
|
@@ -9,5 +9,6 @@ import { mobileRouter } from './src/routes/mobileTrax.routes.js';
|
|
|
9
9
|
import { internalTraxRouter } from './src/routes/internalTraxApi.router.js';
|
|
10
10
|
import { locusOrderRouter } from './src/routes/locus.router.js';
|
|
11
11
|
import { traxActivityLogRouter } from './src/routes/activityLog.router.js';
|
|
12
|
+
import activityLogMiddleware from './src/logging/activityLogMiddleware.js';
|
|
12
13
|
|
|
13
|
-
export { traxDashboardRouter, traxFlagRouter, traxRouter, galleryRouter, downloadRouter, mobileRouter, internalTraxRouter, locusOrderRouter, traxActivityLogRouter };
|
|
14
|
+
export { traxDashboardRouter, traxFlagRouter, traxRouter, galleryRouter, downloadRouter, mobileRouter, internalTraxRouter, locusOrderRouter, traxActivityLogRouter, activityLogMiddleware };
|
package/package.json
CHANGED
|
@@ -1384,40 +1384,40 @@ export async function insertTimeDelayFlags( req, res ) {
|
|
|
1384
1384
|
let updatedDetails = await processedchecklist.updateMany( { _id: { $in: checklistId } }, { timeFlag: 1 } );
|
|
1385
1385
|
|
|
1386
1386
|
|
|
1387
|
-
let notifyStores = await processedchecklist.find( { _id: { $in: checklistId }, notify: { $exists: false } } );
|
|
1388
|
-
|
|
1389
|
-
if ( notifyStores.length ) {
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
}
|
|
1387
|
+
// let notifyStores = await processedchecklist.find( { _id: { $in: checklistId }, notify: { $exists: false } } );
|
|
1388
|
+
|
|
1389
|
+
// if ( notifyStores.length ) {
|
|
1390
|
+
// Promise.all( notifyStores.map( async ( store ) => {
|
|
1391
|
+
// let checklistDetails = await CLconfig.findOne( { _id: store.sourceCheckList_id }, { notifyFlags: 1, approver: 1 } );
|
|
1392
|
+
// if ( checklistDetails?.notifyFlags?.notifyType?.length ) {
|
|
1393
|
+
// let emailList = checklistDetails?.notifyFlags?.notifyType.includes( 'approver' ) ? checklistDetails.approver.map( ( ele ) => ele?.value ): [];
|
|
1394
|
+
// emailList = [ ...emailList, ...checklistDetails?.notifyFlags?.users?.map( ( ele ) => ele?.value ) ];
|
|
1395
|
+
// let data = {
|
|
1396
|
+
// storeName: store.storeName,
|
|
1397
|
+
// flagCount: 1,
|
|
1398
|
+
// checklistName: store.checkListName?.trim(),
|
|
1399
|
+
// submittedBy: '--',
|
|
1400
|
+
// time: '--',
|
|
1401
|
+
// domain: `${JSON.parse( process.env.URL ).domain}/manage/trax/flags?date=${dayjs().format( 'YYYY-MM-DD' )}`,
|
|
1402
|
+
// type: 'delay',
|
|
1403
|
+
// };
|
|
1404
|
+
// const fileContent = fs.readFileSync( path.resolve( path.dirname( '' ) ) + '/src/hbs/flag.hbs', 'utf8' );
|
|
1405
|
+
// const htmlContent = handlebars.compile( fileContent );
|
|
1406
|
+
// const html = htmlContent( { data: data } );
|
|
1407
|
+
// emailList.forEach( ( email ) => {
|
|
1408
|
+
// let params = {
|
|
1409
|
+
// toEmail: email,
|
|
1410
|
+
// mailSubject: 'TangoEye | Checklist Flag',
|
|
1411
|
+
// htmlBody: html,
|
|
1412
|
+
// attachment: '',
|
|
1413
|
+
// sourceEmail: JSON.parse( process.env.SES ).adminEmail,
|
|
1414
|
+
// };
|
|
1415
|
+
// sendEmailWithSES( params.toEmail, params.mailSubject, params.htmlBody, params.attachment, params.sourceEmail );
|
|
1416
|
+
// } );
|
|
1417
|
+
// }
|
|
1418
|
+
// await processedchecklist.updateOne( { _id: store._id }, { notify: true } );
|
|
1419
|
+
// } ) );
|
|
1420
|
+
// }
|
|
1421
1421
|
|
|
1422
1422
|
if ( updatedDetails ) {
|
|
1423
1423
|
return res.sendSuccess( { message: 'Time Delay Updated Successfully' } );
|
|
@@ -3580,7 +3580,6 @@ export async function runAIFlag( req, res ) {
|
|
|
3580
3580
|
try {
|
|
3581
3581
|
let checklistDetails = await CLconfig.find( {
|
|
3582
3582
|
publish: true,
|
|
3583
|
-
client_id: '467',
|
|
3584
3583
|
runAIQuestionCount: { $ne: 0 },
|
|
3585
3584
|
$expr: {
|
|
3586
3585
|
$gt: [
|
|
@@ -3589,21 +3588,23 @@ export async function runAIFlag( req, res ) {
|
|
|
3589
3588
|
],
|
|
3590
3589
|
},
|
|
3591
3590
|
}, { _id: 1, notifyFlags: 1, approver: 1 } );
|
|
3591
|
+
console.log( checklistDetails );
|
|
3592
3592
|
let date = dayjs().format( 'YYYY-MM-DD' );
|
|
3593
3593
|
if ( checklistDetails.length ) {
|
|
3594
3594
|
await Promise.all( checklistDetails.map( async ( ele ) => {
|
|
3595
|
-
let submitDetails = await processedchecklist.find( { sourceCheckList_id: ele._id, date_string: date }, { storeName: 1, checkListName: 1, userName: 1, submitTime_string: 1, runAIFlag: 1, questionFlag: 1, checklistStatus: 1 } );
|
|
3595
|
+
let submitDetails = await processedchecklist.find( { sourceCheckList_id: ele._id, date_string: date, $or: [ { timeFlag: { $gt: 0 } }, { questionFlag: { $gt: 0 } }, { runAIFlag: { $gt: 0 } } ] }, { storeName: 1, checkListName: 1, userName: 1, submitTime_string: 1, runAIFlag: 1, questionFlag: 1, checklistStatus: 1 } );
|
|
3596
|
+
console.log( submitDetails );
|
|
3596
3597
|
let emailList = ele?.notifyFlags?.notifyType.includes( 'approver' ) ? ele.approver.map( ( approver ) => approver?.value ): [];
|
|
3597
3598
|
emailList = [ ...emailList, ...ele?.notifyFlags?.users?.map( ( user ) => user?.value ) ];
|
|
3598
3599
|
await Promise.all( submitDetails.map( ( store ) => {
|
|
3599
3600
|
let data = {
|
|
3600
3601
|
storeName: store.storeName,
|
|
3601
|
-
flagCount: store?.runAIFlag + store?.questionFlag,
|
|
3602
|
+
flagCount: store.timeFlag ? 1 : store?.runAIFlag + store?.questionFlag,
|
|
3602
3603
|
runAIFlag: store?.runAIFlag,
|
|
3603
3604
|
questionFlag: store?.questionFlag,
|
|
3604
3605
|
checklistName: store.checkListName?.trim(),
|
|
3605
3606
|
submittedBy: store?.userName,
|
|
3606
|
-
time: store?.submitTime_string,
|
|
3607
|
+
time: store?.submitTime_string ?? '--',
|
|
3607
3608
|
domain: `${JSON.parse( process.env.URL ).domain}/manage/trax/flags?date=${dayjs().format( 'YYYY-MM-DD' )}`,
|
|
3608
3609
|
status: store.checklistStatus,
|
|
3609
3610
|
};
|
|
@@ -2895,34 +2895,34 @@ export async function submitChecklist( req, res ) {
|
|
|
2895
2895
|
userType: req.user.userType,
|
|
2896
2896
|
};
|
|
2897
2897
|
insertOpenSearchData( openSearch.traxActivityLog, inserttraxlogs );
|
|
2898
|
-
if ( updateData.questionFlag ) {
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
}
|
|
2898
|
+
// if ( updateData.questionFlag ) {
|
|
2899
|
+
// let checklistDetails = await checklistService.findOne( { _id: getchecklist[0].sourceCheckList_id }, { notifyFlags: 1, approver: 1 } );
|
|
2900
|
+
// if ( checklistDetails?.notifyFlags?.notifyType?.length ) {
|
|
2901
|
+
// let emailList = checklistDetails?.notifyFlags?.notifyType.includes( 'approver' ) ? checklistDetails.approver.map( ( ele ) => ele?.value ): [];
|
|
2902
|
+
// emailList = [ ...emailList, ...checklistDetails?.notifyFlags?.users?.map( ( ele ) => ele?.value ) ];
|
|
2903
|
+
// let data = {
|
|
2904
|
+
// storeName: getchecklist[0].storeName,
|
|
2905
|
+
// flagCount: updateData.questionFlag,
|
|
2906
|
+
// checklistName: getchecklist[0].checkListName,
|
|
2907
|
+
// submittedBy: getchecklist[0].userName,
|
|
2908
|
+
// time: updateData.submitTime_string,
|
|
2909
|
+
// domain: `${JSON.parse( process.env.URL ).domain}/manage/trax/flags?date=${dayjs().format( 'YYYY-MM-DD' )}`,
|
|
2910
|
+
// };
|
|
2911
|
+
// const fileContent = fs.readFileSync( path.resolve( path.dirname( '' ) ) + '/src/hbs/flag.hbs', 'utf8' );
|
|
2912
|
+
// const htmlContent = handlebars.compile( fileContent );
|
|
2913
|
+
// const html = htmlContent( { data: data } );
|
|
2914
|
+
// emailList.forEach( ( email ) => {
|
|
2915
|
+
// let params = {
|
|
2916
|
+
// toEmail: email,
|
|
2917
|
+
// mailSubject: 'TangoEye | Checklist Flag',
|
|
2918
|
+
// htmlBody: html,
|
|
2919
|
+
// attachment: '',
|
|
2920
|
+
// sourceEmail: JSON.parse( process.env.SES ).adminEmail,
|
|
2921
|
+
// };
|
|
2922
|
+
// sendEmailWithSES( params.toEmail, params.mailSubject, params.htmlBody, params.attachment, params.sourceEmail );
|
|
2923
|
+
// } );
|
|
2924
|
+
// }
|
|
2925
|
+
// }
|
|
2926
2926
|
}
|
|
2927
2927
|
if ( getchecklist?.[0]?.redoEdit?.toString() != requestData?.redoEdit ) {
|
|
2928
2928
|
return res.sendSuccess( 'New Questions Added So,Checklist moved back to In Progress. Please complete the updated checklist.' );
|
package/src/hbs/flag.hbs
CHANGED
|
@@ -176,7 +176,7 @@
|
|
|
176
176
|
<td class="flagText" style="padding-left:30px; line-height: 24px;">No of Flags :</td>
|
|
177
177
|
<td></td>
|
|
178
178
|
<td></td>
|
|
179
|
-
<td class="flagText">{{data.flagCount}}</td>
|
|
179
|
+
<td class="flagText">{{data.flagCount}}{{#eq data.status 'submit'}}(RunAIFlag:{{data.runAIFlag}},QuestionFlag:{{data.questionFlag}}){{/eq}}</td>
|
|
180
180
|
</tr>
|
|
181
181
|
<tr bgcolor="#ffffff" style="border:none;margin-top:3px;">
|
|
182
182
|
<td class="flagText" style="padding-left:30px; line-height: 24px;">Submitted By :</td>
|