diff --git a/NotificationApi/NotificationApi.AcceptanceTests/ApiTests/GetTemplateTests.cs b/NotificationApi/NotificationApi.AcceptanceTests/ApiTests/GetTemplateTests.cs index bf4c1b27..0132abf7 100644 --- a/NotificationApi/NotificationApi.AcceptanceTests/ApiTests/GetTemplateTests.cs +++ b/NotificationApi/NotificationApi.AcceptanceTests/ApiTests/GetTemplateTests.cs @@ -37,7 +37,6 @@ public class GetTemplateTests : AcApiTest [TestCase(NotificationType.EJudJudgeDemoOrTest)] [TestCase(NotificationType.TelephoneHearingConfirmation)] [TestCase(NotificationType.TelephoneHearingConfirmationMultiDay)] - [TestCase(NotificationType.CreateStaffMember)] [TestCase(NotificationType.HearingAmendmentStaffMember)] [TestCase(NotificationType.HearingConfirmationStaffMember)] [TestCase(NotificationType.HearingConfirmationStaffMemberMultiDay)] diff --git a/NotificationApi/NotificationApi.AcceptanceTests/packages.lock.json b/NotificationApi/NotificationApi.AcceptanceTests/packages.lock.json index d8e9bed7..23ac673a 100644 --- a/NotificationApi/NotificationApi.AcceptanceTests/packages.lock.json +++ b/NotificationApi/NotificationApi.AcceptanceTests/packages.lock.json @@ -811,6 +811,32 @@ "System.Reflection.Emit.Lightweight": "4.3.0" } }, + "Microsoft.Extensions.Diagnostics.HealthChecks": { + "type": "Transitive", + "resolved": "6.0.8", + "contentHash": "xRbKuDnoKClu/lC3fCqF5f0UqEqVI8iYJ0RN4XpUHajvcfCWYcFC46NEzaUg2Fub7hznTG9m6XNScrVHl1iaSA==", + "dependencies": { + "Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions": "6.0.8", + "Microsoft.Extensions.Hosting.Abstractions": "6.0.0", + "Microsoft.Extensions.Logging.Abstractions": "6.0.1", + "Microsoft.Extensions.Options": "6.0.0" + } + }, + "Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions": { + "type": "Transitive", + "resolved": "6.0.8", + "contentHash": "8mNPugigemlybm8f+KcwB5FOEyJ8mZ72stKvOJJqpUFYjfTjFDKFKYB2L98gru1SaxVD9akjw8OyvtbWkAEimQ==" + }, + "Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore": { + "type": "Transitive", + "resolved": "6.0.8", + "contentHash": "NfcEjGvaRyc7OjTeoCSVLlQKzSZeMb96XCuthX/Z9HbPEjXViSewyvOQPIjd6e3pQumIJgltlBRo9o6b3JQsPg==", + "dependencies": { + "Microsoft.EntityFrameworkCore.Relational": "6.0.8", + "Microsoft.Extensions.Diagnostics.HealthChecks": "6.0.8", + "Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions": "6.0.8" + } + }, "Microsoft.Extensions.FileProviders.Abstractions": { "type": "Transitive", "resolved": "6.0.0", @@ -844,13 +870,12 @@ }, "Microsoft.Extensions.Hosting.Abstractions": { "type": "Transitive", - "resolved": "2.2.0", - "contentHash": "+k4AEn68HOJat5gj1TWa6X28WlirNQO9sPIIeQbia+91n03esEtMSSoekSTpMjUzjqtJWQN3McVx0GvSPFHF/Q==", + "resolved": "6.0.0", + "contentHash": "GcT5l2CYXL6Sa27KCSh0TixsRfADUgth+ojQSD5EkzisZxmGFh7CwzkcYuGwvmXLjr27uWRNrJ2vuuEjMhU05Q==", "dependencies": { - "Microsoft.Extensions.Configuration.Abstractions": "2.2.0", - "Microsoft.Extensions.DependencyInjection.Abstractions": "2.2.0", - "Microsoft.Extensions.FileProviders.Abstractions": "2.2.0", - "Microsoft.Extensions.Logging.Abstractions": "2.2.0" + "Microsoft.Extensions.Configuration.Abstractions": "6.0.0", + "Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0", + "Microsoft.Extensions.FileProviders.Abstractions": "6.0.0" } }, "Microsoft.Extensions.Logging": { @@ -867,8 +892,8 @@ }, "Microsoft.Extensions.Logging.Abstractions": { "type": "Transitive", - "resolved": "6.0.0", - "contentHash": "/HggWBbTwy8TgebGSX5DBZ24ndhzi93sHUBDvP1IxbZD7FDokYzdAr6+vbWGjw2XAfR2EJ1sfKUotpjHnFWPxA==" + "resolved": "6.0.1", + "contentHash": "dzB2Cgg+JmrouhjkcQGzSFjjvpwlq353i8oBQO2GWNjCXSzhbtBRUf28HSauWe7eib3wYOdb3tItdjRwAdwCSg==" }, "Microsoft.Extensions.Logging.ApplicationInsights": { "type": "Transitive", @@ -2345,6 +2370,7 @@ "Microsoft.AspNetCore.JsonPatch": "[6.0.8, )", "Microsoft.AspNetCore.Mvc.NewtonsoftJson": "[3.1.6, )", "Microsoft.Extensions.DependencyModel": "[3.1.6, )", + "Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore": "[6.0.8, )", "Microsoft.Extensions.Logging.ApplicationInsights": "[2.15.0, )", "Microsoft.VisualStudio.Azure.Containers.Tools.Targets": "[1.9.10, )", "Microsoft.VisualStudio.Web.CodeGeneration.Design": "[3.1.0, )", diff --git a/NotificationApi/NotificationApi.Client/NotificationApiClient.cs b/NotificationApi/NotificationApi.Client/NotificationApiClient.cs index b76341df..4b5e7e33 100644 --- a/NotificationApi/NotificationApi.Client/NotificationApiClient.cs +++ b/NotificationApi/NotificationApi.Client/NotificationApiClient.cs @@ -25,36 +25,6 @@ namespace NotificationApi.Client [System.CodeDom.Compiler.GeneratedCode("NSwag", "13.18.2.0 (NJsonSchema v10.8.0.0 (Newtonsoft.Json v13.0.0.0))")] public partial interface INotificationApiClient { - /// - /// Check Service Health - /// - /// Error if fails, otherwise OK status - /// A server side error occurred. - System.Threading.Tasks.Task CheckServiceHealthAuthAsync(); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Check Service Health - /// - /// Error if fails, otherwise OK status - /// A server side error occurred. - System.Threading.Tasks.Task CheckServiceHealthAuthAsync(System.Threading.CancellationToken cancellationToken); - - /// - /// Check Service Health - /// - /// Error if fails, otherwise OK status - /// A server side error occurred. - System.Threading.Tasks.Task CheckServiceHealthAuth2Async(); - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Check Service Health - /// - /// Error if fails, otherwise OK status - /// A server side error occurred. - System.Threading.Tasks.Task CheckServiceHealthAuth2Async(System.Threading.CancellationToken cancellationToken); - /// A server side error occurred. System.Threading.Tasks.Task GetTemplateByNotificationTypeAsync(NotificationType notificationType); @@ -118,186 +88,6 @@ public string BaseUrl partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder); partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response); - /// - /// Check Service Health - /// - /// Error if fails, otherwise OK status - /// A server side error occurred. - public virtual System.Threading.Tasks.Task CheckServiceHealthAuthAsync() - { - return CheckServiceHealthAuthAsync(System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Check Service Health - /// - /// Error if fails, otherwise OK status - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task CheckServiceHealthAuthAsync(System.Threading.CancellationToken cancellationToken) - { - var urlBuilder_ = new System.Text.StringBuilder(); - urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/HealthCheck/health"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 500) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new NotificationApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new NotificationApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new NotificationApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new NotificationApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - - /// - /// Check Service Health - /// - /// Error if fails, otherwise OK status - /// A server side error occurred. - public virtual System.Threading.Tasks.Task CheckServiceHealthAuth2Async() - { - return CheckServiceHealthAuth2Async(System.Threading.CancellationToken.None); - } - - /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. - /// - /// Check Service Health - /// - /// Error if fails, otherwise OK status - /// A server side error occurred. - public virtual async System.Threading.Tasks.Task CheckServiceHealthAuth2Async(System.Threading.CancellationToken cancellationToken) - { - var urlBuilder_ = new System.Text.StringBuilder(); - urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/health/liveness"); - - var client_ = _httpClient; - var disposeClient_ = false; - try - { - using (var request_ = new System.Net.Http.HttpRequestMessage()) - { - request_.Method = new System.Net.Http.HttpMethod("GET"); - request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("application/json")); - - PrepareRequest(client_, request_, urlBuilder_); - - var url_ = urlBuilder_.ToString(); - request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute); - - PrepareRequest(client_, request_, url_); - - var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false); - var disposeResponse_ = true; - try - { - var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value); - if (response_.Content != null && response_.Content.Headers != null) - { - foreach (var item_ in response_.Content.Headers) - headers_[item_.Key] = item_.Value; - } - - ProcessResponse(client_, response_); - - var status_ = (int)response_.StatusCode; - if (status_ == 500) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new NotificationApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - throw new NotificationApiException("A server side error occurred.", status_, objectResponse_.Text, headers_, objectResponse_.Object, null); - } - else - if (status_ == 200) - { - var objectResponse_ = await ReadObjectResponseAsync(response_, headers_, cancellationToken).ConfigureAwait(false); - if (objectResponse_.Object == null) - { - throw new NotificationApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null); - } - return objectResponse_.Object; - } - else - { - var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false); - throw new NotificationApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null); - } - } - finally - { - if (disposeResponse_) - response_.Dispose(); - } - } - } - finally - { - if (disposeClient_) - client_.Dispose(); - } - } - /// A server side error occurred. public virtual System.Threading.Tasks.Task GetTemplateByNotificationTypeAsync(NotificationType notificationType) { diff --git a/NotificationApi/NotificationApi.Contract/Responses/HealthResponse.cs b/NotificationApi/NotificationApi.Contract/Responses/HealthResponse.cs deleted file mode 100644 index 9159bdfc..00000000 --- a/NotificationApi/NotificationApi.Contract/Responses/HealthResponse.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace NotificationApi.Contract.Responses -{ - public class HealthResponse - { - public HealthCheck DatabaseHealth { get; set; } - public AppVersionResponse AppVersion { get; set; } - - public HealthResponse() - { - DatabaseHealth = new HealthCheck(); - AppVersion = new AppVersionResponse(); - } - } -} diff --git a/NotificationApi/NotificationApi.DAL/TemplateDataForEnvironments.cs b/NotificationApi/NotificationApi.DAL/TemplateDataForEnvironments.cs index 5fecaf86..3c430e6c 100644 --- a/NotificationApi/NotificationApi.DAL/TemplateDataForEnvironments.cs +++ b/NotificationApi/NotificationApi.DAL/TemplateDataForEnvironments.cs @@ -9,1566 +9,1732 @@ namespace NotificationApi.DAL [ExcludeFromCodeCoverage] public class TemplateDataForEnvironments { - private const string CASE_NAME__CASE_NUMBER__JUDICIAL_OFFICE_HOLDER__DAY_MONTH_YEAR__TIME__USERNAME = "case name, case number, judicial office holder, day month year, time, username"; - - private static Template CreateTemplate(string guid, NotificationType notificationType, MessageType messageType, string parameters) - { - return new Template(new Guid(guid), notificationType, - messageType, parameters); - } - private readonly IList