Pull Request 33523 suggestions

Pull Request 33520 suggestions

Injected AppSettings instead of using GetEnvironmentVariable at Services level

When debugging only
app.Services.GetRequiredService<IPCRBService>();

Get ready to use VSCode IDE

Align .editorconfig files
This commit is contained in:
2024-12-03 10:48:07 -07:00
parent 08fcd985ea
commit 7be540964a
59 changed files with 2821 additions and 214 deletions

View File

@ -1,13 +1,13 @@
using FabApprovalWorkerService.Models;
using System.Net.Mail;
using System.Text;
using FabApprovalWorkerService.Models;
using FabApprovalWorkerService.Services;
using Infineon.Monitoring.MonA;
using Quartz;
using System.Net.Mail;
using System.Text;
namespace FabApprovalWorkerService.Workers;
public class ExpiringTECNWorker : IJob {
@ -22,7 +22,8 @@ public class ExpiringTECNWorker : IJob {
IMonInClient monInClient,
IUserService userService,
IECNService ecnService,
ISmtpService smtpService) {
ISmtpService smtpService,
AppSettings appSettings) {
_logger = logger ??
throw new ArgumentNullException("ILogger not injected");
_monInClient = monInClient ??
@ -33,8 +34,7 @@ public class ExpiringTECNWorker : IJob {
throw new ArgumentNullException("IECNService not injected");
_smtpService = smtpService ??
throw new ArgumentNullException("ISmtpService not injected");
_baseUrl = Environment.GetEnvironmentVariable("FabApprovalBaseUrl") ??
throw new ArgumentNullException("FabApprovalBaseUrl environment variable not found");
_baseUrl = appSettings.BaseUrl;
}
public async Task Execute(IJobExecutionContext context) {
@ -57,8 +57,8 @@ public class ExpiringTECNWorker : IJob {
foreach (ECN eCN in expiringTECNs) {
string recipientEmail = await _userService.GetUserEmail(eCN.OriginatorID);
MailAddress recipientAddress = new MailAddress(recipientEmail);
List<MailAddress> recipientList = new () { recipientAddress };
List<MailAddress> recipientList = new() { recipientAddress };
List<MailAddress> ccRecipientList = new();
foreach (string email in tecnNotificationUserEmails) {
ccRecipientList.Add(new MailAddress(email));
@ -94,4 +94,4 @@ public class ExpiringTECNWorker : IJob {
}
}
}
}
}