diff --git a/.pipeline/lib/config.js b/.pipeline/lib/config.js index c49c1617..81e11b1d 100644 --- a/.pipeline/lib/config.js +++ b/.pipeline/lib/config.js @@ -29,8 +29,8 @@ const phases = { host: `hmcr-d3d940-dev.apps.silver.devops.gov.bc.ca`, url_prefix: "dev-", bceid_service: ".test", - oas_server: "devoas4", - export_server: "devoas4", + oas_server: "prdoas5", + export_server: "tstoas5", dotnet_env: "Development", transient: true, hangfire_cpu: "300m", diff --git a/.pipeline/lib/deploy.js b/.pipeline/lib/deploy.js index 26d5fb10..82e89879 100644 --- a/.pipeline/lib/deploy.js +++ b/.pipeline/lib/deploy.js @@ -3,7 +3,6 @@ const { OpenShiftClientX } = require("@bcgov/pipeline-cli"); const path = require("path"); const util = require("./util"); -const KeyCloakClient = require("./keycloak"); module.exports = (settings) => { const phases = settings.phases; @@ -17,15 +16,12 @@ module.exports = (settings) => { path.resolve(__dirname, "../../openshift") ); var objects = []; - const kc = new KeyCloakClient(settings, oc); const logDbSecret = util.getSecret( oc, phases[phase].namespace, `${phases[phase].name}-logdb${phases[phase].suffix}` ); - kc.addUris(); - // The deployment of your cool app goes here ▼▼▼ objects.push( ...oc.processDeploymentTemplate( diff --git a/api/Hmcr.Api/appsettings.json b/api/Hmcr.Api/appsettings.json index a6915069..79e5aac5 100644 --- a/api/Hmcr.Api/appsettings.json +++ b/api/Hmcr.Api/appsettings.json @@ -21,7 +21,10 @@ "Args": { "configure": [ { - "Name": "Console" + "Name": "Console", + "Args": { + "outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}" + } } ] } @@ -49,7 +52,12 @@ "renderAsText": false } }, - "timestamp": "TimestampColumnWriter", + "timestamp": { + "Name": "TimestampColumnWriter", + "Args": { + "dbType": "Timestamp" + } + }, "exception": "ExceptionColumnWriter", "log_event": "LogEventSerializedColumnWriter", "props_test": { diff --git a/api/Hmcr.Data/Database/Entities/AppDbContextPartial.cs b/api/Hmcr.Data/Database/Entities/AppDbContextPartial.cs index ec77bcba..24b73e08 100644 --- a/api/Hmcr.Data/Database/Entities/AppDbContextPartial.cs +++ b/api/Hmcr.Data/Database/Entities/AppDbContextPartial.cs @@ -4,6 +4,7 @@ using Hmcr.Model.Utils; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.ChangeTracking; +using Microsoft.Extensions.Logging; using System; using System.Collections.Generic; using System.Linq; @@ -26,11 +27,13 @@ public partial class AppDbContext private const string AppLastUpdateUserGuid = "AppLastUpdateUserGuid"; private const string AppLastUpdateTimestamp = "AppLastUpdateTimestamp"; + private readonly ILogger _logger; public readonly HmcrCurrentUser _currentUser; - public AppDbContext(DbContextOptions options, HmcrCurrentUser currentUser) + public AppDbContext(DbContextOptions options, ILogger logger, HmcrCurrentUser currentUser) : base(options) { + _logger = logger; _currentUser = currentUser; } @@ -46,7 +49,8 @@ public override int SaveChanges() } catch (Exception e) { - Console.WriteLine(e); + string exceptionMessage = e.ToString(); + _logger.LogError($"AppDbContext Exception: {exceptionMessage}"); throw; } diff --git a/api/Hmcr.Domain/Hangfire/WorkReportJobService.cs b/api/Hmcr.Domain/Hangfire/WorkReportJobService.cs index 7b693cc2..1cb084c6 100644 --- a/api/Hmcr.Domain/Hangfire/WorkReportJobService.cs +++ b/api/Hmcr.Domain/Hangfire/WorkReportJobService.cs @@ -257,7 +257,8 @@ private List PerformAnalyticalValidationBatchAsync(List recipients, string subject, string h // return true; //} - //Console.WriteLine("Unable to validate certificate chain."); + //_logger.LogError("Unable to validate certificate chain."); //return false; return true; diff --git a/api/Hmcr.Domain/Services/RockfallReportService.cs b/api/Hmcr.Domain/Services/RockfallReportService.cs index aa143afb..97ada124 100644 --- a/api/Hmcr.Domain/Services/RockfallReportService.cs +++ b/api/Hmcr.Domain/Services/RockfallReportService.cs @@ -76,6 +76,12 @@ protected override async Task ParseRowsAsync(SubmissionObjectCreateDto sub } } + if (row == null) + { + errors.AddItem("File", "Row is empty. Please make sure that the report isn't empty, and doesn't have empty data rows"); + break; + } + row.ServiceArea = serviceArea.ConvertToServiceAreaString(row.ServiceArea); rows.Add(row); } diff --git a/api/Hmcr.Domain/Services/WildlifeReportService.cs b/api/Hmcr.Domain/Services/WildlifeReportService.cs index 3bb099d6..b02e55eb 100644 --- a/api/Hmcr.Domain/Services/WildlifeReportService.cs +++ b/api/Hmcr.Domain/Services/WildlifeReportService.cs @@ -74,6 +74,12 @@ protected override async Task ParseRowsAsync(SubmissionObjectCreateDto sub } } + if (row == null) + { + errors.AddItem("File", "Row is empty. Please make sure that the report isn't empty, and doesn't have empty data rows"); + break; + } + row.ServiceArea = serviceArea.ConvertToServiceAreaString(row.ServiceArea); rows.Add(row); } diff --git a/api/Hmcr.Domain/Services/WorkReportService.cs b/api/Hmcr.Domain/Services/WorkReportService.cs index e8060ad1..9be18ae3 100644 --- a/api/Hmcr.Domain/Services/WorkReportService.cs +++ b/api/Hmcr.Domain/Services/WorkReportService.cs @@ -76,6 +76,12 @@ protected override async Task ParseRowsAsync(SubmissionObjectCreateDto sub } } + if (row == null) + { + errors.AddItem("File", "Row is empty. Please make sure that the report isn't empty, and doesn't have empty data rows"); + break; + } + row.ServiceArea = serviceArea.ConvertToServiceAreaString(row.ServiceArea); rows.Add(row); } diff --git a/api/Hmcr.Hangfire/appsettings.json b/api/Hmcr.Hangfire/appsettings.json index 5613860b..5d39045a 100644 --- a/api/Hmcr.Hangfire/appsettings.json +++ b/api/Hmcr.Hangfire/appsettings.json @@ -17,7 +17,12 @@ "Name": "Async", "Args": { "configure": [ - { "Name": "Console" } + { + "Name": "Console", + "Args": { + "outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}" + } + } ] } } diff --git a/openshift/configmaps/api-appsettings.yaml b/openshift/configmaps/api-appsettings.yaml index b2c8682a..645c65e6 100644 --- a/openshift/configmaps/api-appsettings.yaml +++ b/openshift/configmaps/api-appsettings.yaml @@ -25,7 +25,14 @@ objects: { "Name": "Async", "Args": { - "configure": [ { "Name": "Console" } ] + "configure": [ + { + "Name": "Console", + "Args": { + "outputTemplate": "[{Timestamp:yyyy-MM-dd HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}" + } + } + ] } }, { @@ -48,7 +55,12 @@ objects: "renderAsText": false } }, - "timestamp": "TimestampColumnWriter", + "timestamp": { + "Name": "TimestampColumnWriter", + "Args": { + "dbType": "Timestamp" + } + }, "exception": "ExceptionColumnWriter", "log_event": "LogEventSerializedColumnWriter", "props_test": { @@ -141,12 +153,12 @@ parameters: displayName: EXPORT_URL name: EXPORT_URL required: true - value: "https://devoas1.apps.th.gov.bc.ca" + value: "https://tstoas5.apps.th.gov.bc.ca" - description: GeoServer CHRIS API URL displayName: OAS_URL name: OAS_URL required: true - value: "https://devoas1.apps.th.gov.bc.ca" + value: "https://prdoas5.apps.th.gov.bc.ca" - description: Default timeout value for CHRIS/GeoServer API calls displayName: GEOSERVER_TIMEOUT name: GEOSERVER_TIMEOUT