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 ApprovalNotificationWorker : IJob {
@ -31,7 +31,8 @@ public class ApprovalNotificationWorker : IJob {
IPCRBService pcrbService,
ISmtpService smtpService,
IMonInClient monInClient,
IUserService userService) {
IUserService userService,
AppSettings appSettings) {
_logger = logger ?? throw new ArgumentNullException("ILogger not injected");
_approvalService = approvalService ?? throw new ArgumentNullException("IApprovalService not injected");
_ecnService = ecnService ?? throw new ArgumentNullException("IECNService not injected");
@ -41,10 +42,8 @@ public class ApprovalNotificationWorker : IJob {
_smtpService = smtpService ?? throw new ArgumentNullException("ISmtpService not injected");
_monInClient = monInClient ?? throw new ArgumentNullException("IMonInClient not injected");
_userService = userService ?? throw new ArgumentNullException("IUserService not injected");
_oldFabApprovalBaseUrl = Environment.GetEnvironmentVariable("OldFabApprovalUrl") ??
throw new ArgumentNullException("OldFabApprovalUrl environment variable not found");
_newFabApprovalBaseUrl = Environment.GetEnvironmentVariable("NewFabApprovalBaseUrl") ??
throw new ArgumentNullException("NewFabApprovalBaseUrl environment variable not found");
_oldFabApprovalBaseUrl = appSettings.OldBaseUrl;
_newFabApprovalBaseUrl = appSettings.NewBaseUrl;
}
public async Task Execute(IJobExecutionContext context) {
@ -116,8 +115,8 @@ public class ApprovalNotificationWorker : IJob {
if (issueAndUserIds.Contains($"{approval.IssueID}{approval.UserID}")) {
approval.NotifyDate = DateTime.Now;
await _approvalService.UpdateApproval(approval);
} else if ((isEcn || isCa || isMrb || isPcrb) &&
!string.IsNullOrWhiteSpace(title) &&
} else if ((isEcn || isCa || isMrb || isPcrb) &&
!string.IsNullOrWhiteSpace(title) &&
!string.IsNullOrWhiteSpace(url) &&
!issueAndUserIds.Contains($"{approval.IssueID}{approval.UserID}")) {
@ -167,4 +166,4 @@ public class ApprovalNotificationWorker : IJob {
}
}
}
}
}