Created ExpiringTECNWorker
This commit is contained in:
@ -7,6 +7,7 @@ namespace FabApprovalWorkerService.Services;
|
||||
public interface IECNService {
|
||||
Task<IEnumerable<ECN>> GetExpiringTECNs();
|
||||
Task<IEnumerable<ECN>> GetExpiredTECNs();
|
||||
Task<IEnumerable<string>> GetTECNNotificationUserEmails();
|
||||
}
|
||||
|
||||
public class ECNService : IECNService {
|
||||
@ -75,4 +76,24 @@ public class ECNService : IECNService {
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task<IEnumerable<string>> GetTECNNotificationUserEmails() {
|
||||
try {
|
||||
_logger.LogInformation("Attempting to get TECN notification user emails");
|
||||
|
||||
string sql = "select u.Email from TECNNotificationsUsers t join Users u on t.UserId = u.UserID;";
|
||||
|
||||
IEnumerable<string> tecnNotificationUserEmails = (await _dalService.QueryAsync<string>(sql)).ToList();
|
||||
|
||||
_logger.LogInformation($"Found {tecnNotificationUserEmails.Count()} TECN notification user emails");
|
||||
|
||||
return tecnNotificationUserEmails;
|
||||
} catch (Exception ex) {
|
||||
StringBuilder errMsgBuilder = new();
|
||||
errMsgBuilder.Append("An exception occurred when attempting to get TECN notification user emails. ");
|
||||
errMsgBuilder.Append($"Exception: {ex.Message}");
|
||||
_logger.LogError(errMsgBuilder.ToString());
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user