tango-app-api-infra 3.1.34-beta.24 → 3.1.34-beta.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/package.json
CHANGED
|
@@ -462,7 +462,7 @@ export async function emailUserList( req, res ) {
|
|
|
462
462
|
clientList = [ ...clientList, ...spocList ];
|
|
463
463
|
}
|
|
464
464
|
|
|
465
|
-
let findOutsideUserlist = await findmailonlyuser( { clientId: req.query.clientId } );
|
|
465
|
+
let findOutsideUserlist = await findmailonlyuser( { 'clientId': req.query.clientId, 'emailAlert.infra': true } );
|
|
466
466
|
let MailOnlyUsers = [];
|
|
467
467
|
if ( findOutsideUserlist.length > 0 ) {
|
|
468
468
|
for ( let user of findOutsideUserlist ) {
|
|
@@ -526,7 +526,6 @@ export async function emailUserList( req, res ) {
|
|
|
526
526
|
}
|
|
527
527
|
} else if ( user.ticketConfigs.infraReport.type && user.ticketConfigs.infraReport.type === 'defined' ) {
|
|
528
528
|
let times =await generateTimeIntervals( user.ticketConfigs.infraReport.startTime, user.ticketConfigs.infraReport.endTime, user.ticketConfigs.infraReport.interval );
|
|
529
|
-
// console.log( times );
|
|
530
529
|
for ( let store of user.storeList ) {
|
|
531
530
|
const result = await checkStoreTimezoneMatchesInterval( times, store.storeProfile.timeZone );
|
|
532
531
|
if ( result ) {
|
|
@@ -563,7 +562,7 @@ export async function checkStoreTimezoneMatchesInterval( times, storeTimezone )
|
|
|
563
562
|
const intervalTime = dayjs.tz( `${currentStoreTime.format( 'YYYY-MM-DD' )} ${interval}`, 'YYYY-MM-DD HH:mm', storeTimezone );
|
|
564
563
|
const diffInMinutes = intervalTime.diff( currentStoreTime, 'minute' );
|
|
565
564
|
// console.log( diffInMinutes );
|
|
566
|
-
return diffInMinutes >= 0 && diffInMinutes <=
|
|
565
|
+
return diffInMinutes >= 0 && diffInMinutes <= 15;
|
|
567
566
|
} );
|
|
568
567
|
};
|
|
569
568
|
export async function generateTimeIntervals( startTime, endTime, interval ) {
|
|
@@ -765,13 +764,15 @@ export async function infraReportSent( req, res ) {
|
|
|
765
764
|
const fileContent = readFileSync( join() + '/src/hbs/dailyInfraReport.hbs', 'utf8' );
|
|
766
765
|
const htmlContent = handlebars.compile( fileContent );
|
|
767
766
|
let Uidomain = `${JSON.parse( process.env.URL ).domain}`;
|
|
768
|
-
|
|
769
|
-
|
|
770
767
|
const html = htmlContent( { ...req.body, Uidomain: Uidomain, issueCount: issueCount, avgDownTime: avgDownTime, reportdate: date, content: obj, date: date, csmEmail: csmEmail, domain: JSON.parse( process.env.URL ).apiDomain } );
|
|
771
768
|
if ( isValidEmail( req.body.email ) ) {
|
|
772
769
|
const result = await sendEmailWithSES( req.body.email, subject, html, attachments, JSON.parse( process.env.SES ).adminEmail );
|
|
773
770
|
res.sendSuccess( result );
|
|
771
|
+
} else {
|
|
772
|
+
return res.sendError( 'Invalid email', 204 );
|
|
774
773
|
}
|
|
774
|
+
} else {
|
|
775
|
+
return res.sendError( 'No data', 204 );
|
|
775
776
|
}
|
|
776
777
|
} catch ( error ) {
|
|
777
778
|
logger.error( { error: error, function: 'infraReportSent' } );
|