diff --git a/.github/workflows/buildwindowsimage.yml b/.github/workflows/buildwindowsimage.yml index 51ca208..9fca846 100644 --- a/.github/workflows/buildwindowsimage.yml +++ b/.github/workflows/buildwindowsimage.yml @@ -15,6 +15,11 @@ jobs: steps: - uses: actions/checkout@v2.3.4 + - name: Install NET 9 + uses: actions/setup-dotnet@v4.0.1 + with: + dotnet-version: '9.0.x' + - name: Get the version id: get_version uses: battila7/get-version-action@v2 diff --git a/.github/workflows/createrelease.yml b/.github/workflows/createrelease.yml index c4ac31c..fc64e5e 100644 --- a/.github/workflows/createrelease.yml +++ b/.github/workflows/createrelease.yml @@ -15,6 +15,11 @@ jobs: steps: - uses: actions/checkout@v2.3.4 + - name: Install NET 9 + uses: actions/setup-dotnet@v4.0.1 + with: + dotnet-version: '9.0.x' + - name: Get the version id: get_version run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} diff --git a/.github/workflows/nightlybuild.yml b/.github/workflows/nightlybuild.yml index 85ff1be..6dcda0d 100644 --- a/.github/workflows/nightlybuild.yml +++ b/.github/workflows/nightlybuild.yml @@ -16,6 +16,11 @@ jobs: steps: - uses: actions/checkout@v2.3.4 + - name: Install NET 9 + uses: actions/setup-dotnet@v4.0.1 + with: + dotnet-version: '9.0.x' + - name: Set Up Variables run: echo "action_url=$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" >> $GITHUB_ENV diff --git a/.github/workflows/pullrequest.yml b/.github/workflows/pullrequest.yml index 1247940..83e9c02 100644 --- a/.github/workflows/pullrequest.yml +++ b/.github/workflows/pullrequest.yml @@ -15,6 +15,11 @@ jobs: steps: - uses: actions/checkout@v2.3.4 + + - name: Install NET 9 + uses: actions/setup-dotnet@v4.0.1 + with: + dotnet-version: '9.0.x' - name: Restore Nuget Packages run: dotnet restore EstateReportingAPI.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }} diff --git a/.github/workflows/pushtomaster.yml b/.github/workflows/pushtomaster.yml index f0680ee..a327928 100644 --- a/.github/workflows/pushtomaster.yml +++ b/.github/workflows/pushtomaster.yml @@ -18,6 +18,11 @@ jobs: - uses: actions/checkout@v2.3.4 with: fetch-depth: 0 + + - name: Install NET 9 + uses: actions/setup-dotnet@v4.0.1 + with: + dotnet-version: '9.0.x' - name: Restore Nuget Packages run: dotnet restore EstateReportingAPI.sln --source ${{ secrets.PUBLICFEEDURL }} --source ${{ secrets.PRIVATEFEED_URL }} diff --git a/EstateReportingAPI.BusinessLogic/EstateReportingAPI.BusinessLogic.csproj b/EstateReportingAPI.BusinessLogic/EstateReportingAPI.BusinessLogic.csproj index 7442190..5030f43 100644 --- a/EstateReportingAPI.BusinessLogic/EstateReportingAPI.BusinessLogic.csproj +++ b/EstateReportingAPI.BusinessLogic/EstateReportingAPI.BusinessLogic.csproj @@ -1,16 +1,16 @@  - net8.0 + net9.0 enable enable - - - - + + + + diff --git a/EstateReportingAPI.BusinessLogic/ReportingManager.cs b/EstateReportingAPI.BusinessLogic/ReportingManager.cs index b4f7052..eca708a 100644 --- a/EstateReportingAPI.BusinessLogic/ReportingManager.cs +++ b/EstateReportingAPI.BusinessLogic/ReportingManager.cs @@ -324,10 +324,10 @@ public async Task GetTodaysFailedSales(Guid estateId, DateTime comp TodaysSales response = new TodaysSales{ ComparisonSalesCount = comparisonSales.Count, ComparisonSalesValue = comparisonSales.Sum(), - ComparisonAverageSalesValue = comparisonSales.Sum() / comparisonSales.Count, + ComparisonAverageSalesValue = SafeDivide(comparisonSales.Sum(),comparisonSales.Count), TodaysSalesCount = todaysSales.Count, TodaysSalesValue = todaysSales.Sum(), - TodaysAverageSalesValue = todaysSales.Sum() / todaysSales.Count + TodaysAverageSalesValue = SafeDivide(todaysSales.Sum(),todaysSales.Count) }; return response; } diff --git a/EstateReportingAPI.Client/EstateReportingAPI.Client.csproj b/EstateReportingAPI.Client/EstateReportingAPI.Client.csproj index c511aa9..5dc0352 100644 --- a/EstateReportingAPI.Client/EstateReportingAPI.Client.csproj +++ b/EstateReportingAPI.Client/EstateReportingAPI.Client.csproj @@ -1,15 +1,15 @@  - net8.0 + net9.0 $(TargetsForTfmSpecificBuildOutput);IncludeP2PAssets enable - + - + diff --git a/EstateReportingAPI.Client/EstateReportingApiClient.cs b/EstateReportingAPI.Client/EstateReportingApiClient.cs index 0fe1a86..329f7b5 100644 --- a/EstateReportingAPI.Client/EstateReportingApiClient.cs +++ b/EstateReportingAPI.Client/EstateReportingApiClient.cs @@ -15,7 +15,6 @@ namespace EstateReportingAPI.Client{ using ClientProxyBase; using DataTransferObjects; using DataTrasferObjects; - using Microsoft.AspNetCore.Http; using Newtonsoft.Json; public class EstateReportingApiClient : ClientProxyBase, IEstateReportingApiClient{ diff --git a/EstateReportingAPI.DataTrasferObjects/EstateReportingAPI.DataTransferObjects.csproj b/EstateReportingAPI.DataTrasferObjects/EstateReportingAPI.DataTransferObjects.csproj index fa0317b..398bf12 100644 --- a/EstateReportingAPI.DataTrasferObjects/EstateReportingAPI.DataTransferObjects.csproj +++ b/EstateReportingAPI.DataTrasferObjects/EstateReportingAPI.DataTransferObjects.csproj @@ -1,7 +1,7 @@  - netstandard2.1 + net9.0 enable None diff --git a/EstateReportingAPI.IntegrationTests/DimensionControllerTests.cs b/EstateReportingAPI.IntegrationTests/DimensionControllerTests.cs index e830347..3e7ece4 100644 --- a/EstateReportingAPI.IntegrationTests/DimensionControllerTests.cs +++ b/EstateReportingAPI.IntegrationTests/DimensionControllerTests.cs @@ -40,8 +40,9 @@ public async Task DimensionsController_GetCalendarYears_YearsReturned() await helper.AddCalendarYear(year); } - List years = await ApiClient.GetCalendarYears(string.Empty, Guid.NewGuid(), CancellationToken.None); - + var result = await ApiClient.GetCalendarYears(string.Empty, Guid.NewGuid(), CancellationToken.None); + result.IsSuccess.ShouldBeTrue(); + var years = result.Data; years.ShouldNotBeNull(); years.Count.ShouldBe(yearList.Count); } @@ -52,9 +53,10 @@ public async Task DimensionsController_GetCalendarComparisonDates_DatesReturned( List datesInYear = helper.GetDatesForYear(DateTime.Now.Year); await helper.AddCalendarDates(datesInYear); - List dates = await ApiClient.GetComparisonDates(string.Empty, Guid.NewGuid(), CancellationToken.None); - - List expectedDates = datesInYear.Where(d => d <= DateTime.Now.Date.AddDays(-1)).ToList(); + Result> result = await ApiClient.GetComparisonDates(string.Empty, Guid.NewGuid(), CancellationToken.None); + result.IsSuccess.ShouldBeTrue(); + List dates = result.Data; + List expectedDates = datesInYear.Where(d => d <= DateTime.Now.Date.AddDays(-1)).ToList(); int expectedCount = expectedDates.Count + 2; dates.ShouldNotBeNull(); dates.Count.ShouldBe(expectedCount); diff --git a/EstateReportingAPI.IntegrationTests/EstateReportingAPI.IntegrationTests.csproj b/EstateReportingAPI.IntegrationTests/EstateReportingAPI.IntegrationTests.csproj index 63e00c2..a180061 100644 --- a/EstateReportingAPI.IntegrationTests/EstateReportingAPI.IntegrationTests.csproj +++ b/EstateReportingAPI.IntegrationTests/EstateReportingAPI.IntegrationTests.csproj @@ -1,18 +1,18 @@  - net8.0 - None + net9.0 + Full false - - - - + + + + - + runtime; build; native; contentfiles; analyzers; buildtransitive all @@ -21,14 +21,14 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - - + + - - - - - + + + + + diff --git a/EstateReportingAPI.IntegrationTests/FactTransactionsControllerTests.cs b/EstateReportingAPI.IntegrationTests/FactTransactionsControllerTests.cs index a9ef19e..aa9a924 100644 --- a/EstateReportingAPI.IntegrationTests/FactTransactionsControllerTests.cs +++ b/EstateReportingAPI.IntegrationTests/FactTransactionsControllerTests.cs @@ -1310,7 +1310,8 @@ public async Task FactTransactionsControllerController_TodaysFailedSales_SalesRe var comparisonDateTransactions = new List(); DatabaseHelper helper = new DatabaseHelper(context); // TODO: make counts dynamic - DateTime todaysDateTime = DateTime.Now; + DateTime todaysDateTime = DateTime.Now.Date; + todaysDateTime = todaysDateTime.AddHours(12).AddMinutes(30); Dictionary transactionCounts = new() { { "Test Merchant 1", 3 }, { "Test Merchant 2", 6 }, { "Test Merchant 3", 2 }, { "Test Merchant 4", 0 } }; @@ -1338,7 +1339,7 @@ public async Task FactTransactionsControllerController_TodaysFailedSales_SalesRe foreach ((Guid productId, String productName, Decimal? productValue) product in productList) { var transactionCount = transactionCounts.Single(m => m.Key == merchant.Name).Value; for (int i = 0; i < transactionCount; i++) { - Transaction transaction = await helper.BuildTransactionX(comparisonDate, merchant.MerchantId, contract.operatorId, contract.contractId, product.productId, "1009", product.productValue); + Transaction transaction = await helper.BuildTransactionX(comparisonDate.AddHours(-1), merchant.MerchantId, contract.operatorId, contract.contractId, product.productId, "1009", product.productValue); comparisonDateTransactions.Add(transaction); } } diff --git a/EstateReportingAPI.Models/EstateReportingAPI.Models.csproj b/EstateReportingAPI.Models/EstateReportingAPI.Models.csproj index bf8ca4e..279ad60 100644 --- a/EstateReportingAPI.Models/EstateReportingAPI.Models.csproj +++ b/EstateReportingAPI.Models/EstateReportingAPI.Models.csproj @@ -1,7 +1,7 @@ - net8.0 + net9.0 enable enable None diff --git a/EstateReportingAPI.Tests/EstateReportingAPI.Tests.csproj b/EstateReportingAPI.Tests/EstateReportingAPI.Tests.csproj index 5a08b20..c717162 100644 --- a/EstateReportingAPI.Tests/EstateReportingAPI.Tests.csproj +++ b/EstateReportingAPI.Tests/EstateReportingAPI.Tests.csproj @@ -1,26 +1,26 @@  - net8.0 + net9.0 None false - - - - - - + + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/EstateReportingAPI/Controllers/DimensionsController.cs b/EstateReportingAPI/Controllers/DimensionsController.cs index 442b87c..d75af0e 100644 --- a/EstateReportingAPI/Controllers/DimensionsController.cs +++ b/EstateReportingAPI/Controllers/DimensionsController.cs @@ -2,6 +2,7 @@ using EstateReportingAPI.Models; using MediatR; using Shared.Results; +using Shared.Results.Web; using SimpleResults; namespace EstateReportingAPI.Controllers diff --git a/EstateReportingAPI/Controllers/FactSettlementController.cs b/EstateReportingAPI/Controllers/FactSettlementController.cs index 3e67749..8f60169 100644 --- a/EstateReportingAPI/Controllers/FactSettlementController.cs +++ b/EstateReportingAPI/Controllers/FactSettlementController.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Mvc; using System.Diagnostics.CodeAnalysis; using EstateReportingAPI.BusinessLogic.Queries; +using Shared.Results.Web; namespace EstateReportingAPI.Controllers { diff --git a/EstateReportingAPI/Controllers/FactTransactionsController.cs b/EstateReportingAPI/Controllers/FactTransactionsController.cs index b60dbaf..38b29db 100644 --- a/EstateReportingAPI/Controllers/FactTransactionsController.cs +++ b/EstateReportingAPI/Controllers/FactTransactionsController.cs @@ -4,6 +4,7 @@ using JasperFx.Core; using MediatR; using Shared.Results; +using Shared.Results.Web; namespace EstateReportingAPI.Controllers{ using DataTransferObjects; diff --git a/EstateReportingAPI/Dockerfile b/EstateReportingAPI/Dockerfile index b0dd50b..2d4f2ea 100644 --- a/EstateReportingAPI/Dockerfile +++ b/EstateReportingAPI/Dockerfile @@ -1,7 +1,7 @@ FROM stuartferguson/txnprocbase AS base WORKDIR /app -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build WORKDIR /src COPY ["EstateReportingAPI/NuGet.Config", "."] COPY ["EstateReportingAPI/EstateReportingAPI.csproj", "EstateReportingAPI/"] diff --git a/EstateReportingAPI/Dockerfilewindows b/EstateReportingAPI/Dockerfilewindows index 8d1650f..f429699 100644 --- a/EstateReportingAPI/Dockerfilewindows +++ b/EstateReportingAPI/Dockerfilewindows @@ -2,7 +2,7 @@ FROM stuartferguson/txnprocbasewindows AS base USER ContainerAdministrator WORKDIR /app -FROM mcr.microsoft.com/dotnet/sdk:8.0-windowsservercore-ltsc2022 AS build +FROM mcr.microsoft.com/dotnet/sdk:9.0-windowsservercore-ltsc2022 AS build WORKDIR /src COPY ["EstateReportingAPI/NuGet.Config", "."] COPY ["EstateReportingAPI/EstateReportingAPI.csproj", "EstateReportingAPI/"] diff --git a/EstateReportingAPI/EstateReportingAPI.csproj b/EstateReportingAPI/EstateReportingAPI.csproj index 0da4389..f8c9566 100644 --- a/EstateReportingAPI/EstateReportingAPI.csproj +++ b/EstateReportingAPI/EstateReportingAPI.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 enable enable 3ed94abc-423c-49b8-ac5d-edc80e1eaa74 @@ -10,32 +10,33 @@ - + - + + - - - - + + + + - - - - - - - - - - + + + + + + + + + +