Skip to content

Commit 9fa03ea

Browse files
committed
Merge branch '1.0.7' of https://github.com/bcgov/crt into 1.0.7
2 parents 3954431 + a9bd792 commit 9fa03ea

File tree

13 files changed

+93
-44
lines changed

13 files changed

+93
-44
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This web application is intended to replace the current access based tool which
66

77
## Prerequisites
88

9-
- .Net 5 SDK
9+
- .Net 7
1010
- Node.JS v13.7.0 or newer
1111
- Microsoft SQL Server 2017 or newer
1212

@@ -90,3 +90,4 @@ Use the following steps to run the local development environment
9090

9191
Refer to [this document](openshift/README.md) for OpenShift Deployment and Pipeline related topics
9292

93+

api/Crt.Api/Crt.Api.csproj

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
66
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
77
<IsPackable>false</IsPackable>
88
<Authors>Ministry of Transportation and Infrastructure</Authors>
99
<Company>Ministry of Transportation and Infrastructure</Company>
1010
<Description>The API server for CRT (Capital Rehabilitation Project Tracking)</Description>
1111
<Copyright>Copyright© 2020, Province of British Columbia.</Copyright>
12+
<TargetFrameworks></TargetFrameworks>
1213
</PropertyGroup>
1314

1415
<ItemGroup>
@@ -21,18 +22,18 @@
2122
<PackageReference Include="Hangfire.AspNetCore" Version="1.7.18" />
2223
<PackageReference Include="HangFire.Core" Version="1.7.18" />
2324
<PackageReference Include="HangFire.SqlServer" Version="1.7.18" />
24-
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="5.0.9" />
25+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="7.0.9" />
2526
<PackageReference Include="Microsoft.AspNetCore.Http.Extensions" Version="2.2.0" />
26-
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="5.0.0" />
27-
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="5.0.0" />
27+
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="7.0.9" />
28+
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" Version="7.0.9" />
2829
<PackageReference Include="Microsoft.AspNetCore.WebUtilities" Version="2.2.0" />
29-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.0" />
30-
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.0">
30+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.9" />
31+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.9">
3132
<PrivateAssets>all</PrivateAssets>
3233
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3334
</PackageReference>
34-
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="5.0.0" />
35-
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="5.0.0" />
35+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
36+
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="7.0.9" />
3637
<PackageReference Include="NetCore.AutoRegisterDi" Version="2.1.0" />
3738
<PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />
3839
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.1.3" />

api/Crt.Api/appsettings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"AllowedHosts": "*",
33
"Constants": {
4-
"Version": "1.0.5.0",
4+
"Version": "1.0.6.0",
55
"SwaggerApiUrl": "/swagger/v1/swagger.json"
66
},
77
"Serilog": {

api/Crt.Data/Crt.Data.csproj

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
88
<PackageReference Include="AutoMapper" Version="10.1.1" />
9-
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.0">
9+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.9">
1010
<PrivateAssets>all</PrivateAssets>
1111
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
1212
</PackageReference>
13-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.0" />
14-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite" Version="5.0.0" />
15-
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="5.0.0" />
13+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="7.0.9" />
14+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite" Version="7.0.9" />
15+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
1616
<PackageReference Include="System.Linq.Dynamic.Core" Version="1.2.5" />
1717
</ItemGroup>
1818

api/Crt.Data/Database/Entities/AppDbContext.cs

+36
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
using System;
22
using Microsoft.EntityFrameworkCore;
33
using Microsoft.EntityFrameworkCore.Metadata;
4+
using Microsoft.EntityFrameworkCore.Metadata.Builders;
5+
using Microsoft.EntityFrameworkCore.Metadata.Conventions;
6+
using System.Linq;
7+
8+
49

510
#nullable disable
611

@@ -4353,6 +4358,37 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
43534358
OnModelCreatingPartial(modelBuilder);
43544359
}
43554360

4361+
public class BlankTriggerAddingConvention : IModelFinalizingConvention
4362+
{
4363+
public virtual void ProcessModelFinalizing(
4364+
IConventionModelBuilder modelBuilder,
4365+
IConventionContext<IConventionModelBuilder> context)
4366+
{
4367+
foreach (var entityType in modelBuilder.Metadata.GetEntityTypes())
4368+
{
4369+
var table = StoreObjectIdentifier.Create(entityType, StoreObjectType.Table);
4370+
if (table != null
4371+
&& entityType.GetDeclaredTriggers().All(t => t.GetDatabaseName(table.Value) == null))
4372+
{
4373+
entityType.Builder.HasTrigger(table.Value.Name + "_Trigger");
4374+
}
4375+
4376+
foreach (var fragment in entityType.GetMappingFragments(StoreObjectType.Table))
4377+
{
4378+
if (entityType.GetDeclaredTriggers().All(t => t.GetDatabaseName(fragment.StoreObject) == null))
4379+
{
4380+
entityType.Builder.HasTrigger(fragment.StoreObject.Name + "_Trigger");
4381+
}
4382+
}
4383+
}
4384+
}
4385+
}
4386+
4387+
protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
4388+
{
4389+
configurationBuilder.Conventions.Add(_ => new BlankTriggerAddingConvention());
4390+
}
4391+
43564392
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
43574393
}
43584394
}

api/Crt.Domain/Crt.Domain.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
88
<PackageReference Include="CsvHelper" Version="16.1.0" />
99
<PackageReference Include="Hangfire.Core" Version="1.7.18" />
1010
<PackageReference Include="MailKit" Version="2.10.0" />
11-
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="5.0.0" />
12-
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
11+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
12+
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
1313
<PackageReference Include="Novell.Directory.Ldap.NETStandard" Version="3.4.0" />
1414
</ItemGroup>
1515

api/Crt.Domain/Services/RatioService.cs

+10
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,11 @@ private async Task<List<RatioCreateDto>> PerformElectoralRatioDetermination(List
299299

300300
if (percentInPolygon > 0)
301301
{
302+
var existingRatioRecord = _validator.CodeLookup
303+
.Where(x => x.CodeSet == CodeSet.ElectoralDistrict && x.CodeValueText == polygon.Name)
304+
.FirstOrDefault();
305+
if (existingRatioRecord == null) continue;
306+
302307
//generate the new ratio
303308
var newRatio = new RatioCreateDto
304309
{
@@ -336,6 +341,11 @@ private async Task<List<RatioCreateDto>> PerformEconomicRegionRatioDetermination
336341

337342
if (percentInPolygon > 0)
338343
{
344+
var existingRatioRecord = _validator.CodeLookup
345+
.Where(x => x.CodeSet == CodeSet.EconomicRegion && x.CodeValueText == polygon.Number)
346+
.FirstOrDefault();
347+
if (existingRatioRecord == null) continue;
348+
339349
//generate the new ratio
340350
var newRatio = new RatioCreateDto
341351
{

api/Crt.Hangfire/Crt.Hangfire.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
66
<TypeScriptToolsVersion>Latest</TypeScriptToolsVersion>
77
<IsPackable>false</IsPackable>

api/Crt.HttpClients/Crt.HttpClients.csproj

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
@@ -24,11 +24,11 @@
2424

2525
<ItemGroup>
2626
<PackageReference Include="GeoJSON.Net" Version="1.2.19" />
27-
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="5.0.0" />
28-
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="5.0.0" />
29-
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="5.0.0" />
30-
<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />
31-
<PackageReference Include="NetTopologySuite" Version="2.2.0" />
27+
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
28+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
29+
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
30+
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
31+
<PackageReference Include="NetTopologySuite" Version="2.5.0" />
3232
<PackageReference Include="NetTopologySuite.IO.GeoJSON" Version="2.0.4" />
3333
</ItemGroup>
3434

api/Crt.Model/Crt.Model.csproj

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
88
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="5.0.0" />
9-
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite" Version="5.0.0" />
10-
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="5.0.0" />
11-
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="5.0.0" />
12-
<PackageReference Include="Microsoft.Extensions.Hosting" Version="5.0.0" />
9+
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer.NetTopologySuite" Version="7.0.9" />
10+
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
11+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
12+
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
1313
</ItemGroup>
1414

1515
</Project>

api/Crt.Tests/Crt.Tests.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55

66
<IsPackable>false</IsPackable>
77
</PropertyGroup>
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net5.0</TargetFramework>
4+
<TargetFramework>net7.0</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
88
<PackageReference Include="HaemmerElectronics.SeppPenner.SerilogSinkForPostgreSQL" Version="3.1.0" />
9-
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0" />
10-
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="5.0.0" />
9+
<PackageReference Include="Microsoft.Extensions.Configuration" Version="7.0.0" />
10+
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
1111
</ItemGroup>
1212

1313
</Project>

openshift/api-build-config.yaml

+5-4
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,16 @@ objects:
2424
- apiVersion: "v1"
2525
kind: ImageStream
2626
metadata:
27-
name: dotnet-50-rhel8
27+
name: dotnet-70
2828
spec:
2929
lookupPolicy:
3030
local: false
3131
tags:
3232
- annotations: null
3333
from:
3434
kind: DockerImage
35-
name: registry.redhat.io/rhel8/dotnet-50:5.0-4
36-
name: "5.0"
35+
name: registry.redhat.io/rhel8/dotnet-70:7.0-18
36+
name: "7.0"
3737
referencePolicy:
3838
type: Local
3939
- apiVersion: v1
@@ -79,7 +79,8 @@ objects:
7979
value: Crt.Api/Crt.Api.csproj
8080
from:
8181
kind: ImageStreamTag
82-
name: "dotnet-50-rhel8:5.0"
82+
name: "dotnet-70:7.0"
83+
8384
type: Source
8485
parameters:
8586
- description: Name of the project (CRT)

0 commit comments

Comments
 (0)