From a8980bfd9f1b23d5c4c740cdc65570541ea7fc9f Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Wed, 11 Mar 2026 17:41:18 +0100 Subject: [PATCH 1/6] Update GitHub reusable workflow --- .github/workflows/ci.yaml | 8 ++++---- .github/workflows/pkg.yaml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cd20b4ff..bbb50e31 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -37,13 +37,13 @@ jobs: markup-lint: name: Markup - uses: devpro/github-workflow-parts/.github/workflows/reusable-markup-lint.yml@87fc4cf004979998211b2c2126e903e7ea06f9c1 + uses: devpro/github-workflow-parts/.github/workflows/reusable-markup-lint.yml@b5937db15c2a060f3c9dd989ca06bac7eccc75a7 code-quality: name: Code needs: git-check if: needs.git-check.outputs.app_changed == 'true' || (github.event_name == 'workflow_dispatch' && inputs.run-code-quality) - uses: devpro/github-workflow-parts/.github/workflows/reusable-dotnet-quality.yml@87fc4cf004979998211b2c2126e903e7ea06f9c1 + uses: devpro/github-workflow-parts/.github/workflows/reusable-dotnet-quality.yml@b5937db15c2a060f3c9dd989ca06bac7eccc75a7 with: custom-commands: | ./scripts/mongodb-install.sh @@ -61,7 +61,7 @@ jobs: sonar-organization: ${{ vars.SONAR_ORG }} sonar-project-key: ${{ vars.SONAR_PROJECT_KEY }} sonar-project-name: Keeptrack - workflow-parts-version: 87fc4cf004979998211b2c2126e903e7ea06f9c1 + workflow-parts-version: b5937db15c2a060f3c9dd989ca06bac7eccc75a7 secrets: fossa-api-key: ${{ secrets.FOSSA_API_KEY }} sonar-token: ${{ secrets.SONAR_TOKEN }} @@ -89,7 +89,7 @@ jobs: - name: "Web Api" image-name: "keeptrack-webapi" image-definition: "src/WebApi/Dockerfile" - uses: devpro/github-workflow-parts/.github/workflows/reusable-container-scan.yml@87fc4cf004979998211b2c2126e903e7ea06f9c1 + uses: devpro/github-workflow-parts/.github/workflows/reusable-container-scan.yml@b5937db15c2a060f3c9dd989ca06bac7eccc75a7 with: image-definition: ${{ matrix.image-definition }} image-name: ${{ matrix.image-name }} diff --git a/.github/workflows/pkg.yaml b/.github/workflows/pkg.yaml index 75150b87..4b1d44a6 100644 --- a/.github/workflows/pkg.yaml +++ b/.github/workflows/pkg.yaml @@ -28,7 +28,7 @@ jobs: permissions: id-token: write contents: read - uses: devpro/github-workflow-parts/.github/workflows/reusable-container-publication.yml@87fc4cf004979998211b2c2126e903e7ea06f9c1 + uses: devpro/github-workflow-parts/.github/workflows/reusable-container-publication.yml@b5937db15c2a060f3c9dd989ca06bac7eccc75a7 with: create-latest: ${{ github.ref_name == 'main' }} image-definition: ${{ matrix.image-definition }} From 67665a1f2f62b0db59cf784dde38d252364b310c Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Wed, 11 Mar 2026 17:41:34 +0100 Subject: [PATCH 2/6] Add proto https to mongodb install script curl --- scripts/mongodb-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mongodb-install.sh b/scripts/mongodb-install.sh index 8f1c6025..064c91b7 100755 --- a/scripts/mongodb-install.sh +++ b/scripts/mongodb-install.sh @@ -2,7 +2,7 @@ set -euo pipefail echo "Install and start MongoDB 8.2" -curl --tlsv1.2 -sSf -L https://www.mongodb.org/static/pgp/server-8.0.asc | \ +curl --proto "=https" --tlsv1.2 -sSf -L https://www.mongodb.org/static/pgp/server-8.0.asc | \ sudo gpg -o /usr/share/keyrings/mongodb-server-8.0.gpg \ --dearmor echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-8.0.gpg ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.2 multiverse" | From 4b5315ab0088279edaf6750ad242bfe6266c92d7 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Wed, 11 Mar 2026 17:41:58 +0100 Subject: [PATCH 3/6] Delete IgnoreAntiforgeryToken from auth controller --- .../Components/Account/Controllers/AuthenticationController.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/BlazorApp/Components/Account/Controllers/AuthenticationController.cs b/src/BlazorApp/Components/Account/Controllers/AuthenticationController.cs index dc3de94b..68356a8a 100644 --- a/src/BlazorApp/Components/Account/Controllers/AuthenticationController.cs +++ b/src/BlazorApp/Components/Account/Controllers/AuthenticationController.cs @@ -12,7 +12,6 @@ public record TokenRequest(string IdToken); public class AuthenticationController : ControllerBase { [HttpPost("callback")] - [IgnoreAntiforgeryToken] public async Task Callback([FromBody] TokenRequest request) { if (string.IsNullOrWhiteSpace(request?.IdToken)) From d8ea32c831fd06165c66f84743b338f2f8e3dc16 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Wed, 11 Mar 2026 18:12:50 +0100 Subject: [PATCH 4/6] Fix bug with datetime saved the day before --- src/BlazorApp/Components/Inventory/Pages/Books.razor | 2 +- src/Domain/Models/BookModel.cs | 2 +- src/Domain/Models/CarHistoryModel.cs | 2 +- src/Domain/Models/VideoGameModel.cs | 4 ++-- src/WebApi.Contracts/Dto/BookDto.cs | 2 +- src/WebApi.Contracts/Dto/CarHistoryDto.cs | 2 +- src/WebApi.Contracts/Dto/VideoGameDto.cs | 4 ++-- src/WebApi/Controllers/DataCrudControllerBase.cs | 2 +- src/WebApi/MappingProfiles/DataStorageMappingProfile.cs | 3 +++ 9 files changed, 13 insertions(+), 10 deletions(-) diff --git a/src/BlazorApp/Components/Inventory/Pages/Books.razor b/src/BlazorApp/Components/Inventory/Pages/Books.razor index b960a982..4770787c 100644 --- a/src/BlazorApp/Components/Inventory/Pages/Books.razor +++ b/src/BlazorApp/Components/Inventory/Pages/Books.razor @@ -43,7 +43,7 @@ - + diff --git a/src/Domain/Models/BookModel.cs b/src/Domain/Models/BookModel.cs index 8859ac7e..d27c7692 100644 --- a/src/Domain/Models/BookModel.cs +++ b/src/Domain/Models/BookModel.cs @@ -15,5 +15,5 @@ public class BookModel : IHasIdAndOwnerId public string? Series { get; set; } - public DateTime? FinishedAt { get; set; } + public DateOnly? FinishedAt { get; set; } } diff --git a/src/Domain/Models/CarHistoryModel.cs b/src/Domain/Models/CarHistoryModel.cs index 3ad00af3..0af144f1 100644 --- a/src/Domain/Models/CarHistoryModel.cs +++ b/src/Domain/Models/CarHistoryModel.cs @@ -11,7 +11,7 @@ public class CarHistoryModel : IHasIdAndOwnerId public required string CarId { get; set; } - public DateTime HistoryDate { get; set; } + public DateOnly HistoryDate { get; set; } public int? Mileage { get; set; } diff --git a/src/Domain/Models/VideoGameModel.cs b/src/Domain/Models/VideoGameModel.cs index 70472bdf..497395ce 100644 --- a/src/Domain/Models/VideoGameModel.cs +++ b/src/Domain/Models/VideoGameModel.cs @@ -13,9 +13,9 @@ public class VideoGameModel : IHasIdAndOwnerId public required string Platform { get; set; } - public DateTime? ReleasedAt { get; set; } + public DateOnly? ReleasedAt { get; set; } public required string State { get; set; } - public DateTime? FinishedAt { get; set; } + public DateOnly? FinishedAt { get; set; } } diff --git a/src/WebApi.Contracts/Dto/BookDto.cs b/src/WebApi.Contracts/Dto/BookDto.cs index d66cbfa2..0519b383 100644 --- a/src/WebApi.Contracts/Dto/BookDto.cs +++ b/src/WebApi.Contracts/Dto/BookDto.cs @@ -34,5 +34,5 @@ public class BookDto : IHasId /// /// Book finished reading date. /// - public DateTime? FinishedAt { get; set; } + public DateOnly? FinishedAt { get; set; } } diff --git a/src/WebApi.Contracts/Dto/CarHistoryDto.cs b/src/WebApi.Contracts/Dto/CarHistoryDto.cs index dec6dce7..b2c2685a 100644 --- a/src/WebApi.Contracts/Dto/CarHistoryDto.cs +++ b/src/WebApi.Contracts/Dto/CarHistoryDto.cs @@ -21,7 +21,7 @@ public class CarHistoryDto : IHasId /// /// History date. /// - public DateTime HistoryDate { get; set; } + public DateOnly HistoryDate { get; set; } /// /// Mileage indicated on the car. diff --git a/src/WebApi.Contracts/Dto/VideoGameDto.cs b/src/WebApi.Contracts/Dto/VideoGameDto.cs index 388ff43b..c2416411 100644 --- a/src/WebApi.Contracts/Dto/VideoGameDto.cs +++ b/src/WebApi.Contracts/Dto/VideoGameDto.cs @@ -26,7 +26,7 @@ public class VideoGameDto : IHasId /// /// Released date. /// - public DateTime? ReleasedAt { get; set; } + public DateOnly? ReleasedAt { get; set; } /// /// Current payling state. @@ -36,5 +36,5 @@ public class VideoGameDto : IHasId /// /// Finished date. /// - public DateTime? FinishedAt { get; set; } + public DateOnly? FinishedAt { get; set; } } diff --git a/src/WebApi/Controllers/DataCrudControllerBase.cs b/src/WebApi/Controllers/DataCrudControllerBase.cs index 92a7f638..affab3ca 100644 --- a/src/WebApi/Controllers/DataCrudControllerBase.cs +++ b/src/WebApi/Controllers/DataCrudControllerBase.cs @@ -25,7 +25,7 @@ public async Task>> Get([FromQuery] PagedRequest pagedRequest.PageSize, pagedRequest.Search, mapper.Map(input)); - return Ok(models.Map(model => mapper.Map(model))); + return Ok(models.Map(mapper.Map)); } [HttpGet("{id}")] diff --git a/src/WebApi/MappingProfiles/DataStorageMappingProfile.cs b/src/WebApi/MappingProfiles/DataStorageMappingProfile.cs index a96b1d1c..c380cafb 100644 --- a/src/WebApi/MappingProfiles/DataStorageMappingProfile.cs +++ b/src/WebApi/MappingProfiles/DataStorageMappingProfile.cs @@ -17,5 +17,8 @@ public DataStorageMappingProfile() CreateMap(); CreateMap(); + + CreateMap().ConvertUsing(dt => DateOnly.FromDateTime(dt)); + CreateMap().ConvertUsing(d => d.ToDateTime(TimeOnly.MinValue, DateTimeKind.Utc)); } } From f732a4d79c5836ef8a10a0d4c3b5cb29637f0e75 Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Wed, 11 Mar 2026 18:16:14 +0100 Subject: [PATCH 5/6] Add env to azure devops pipeline dotnet test --- .azure/pipelines/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.azure/pipelines/ci.yml b/.azure/pipelines/ci.yml index a46e9155..d0e04893 100644 --- a/.azure/pipelines/ci.yml +++ b/.azure/pipelines/ci.yml @@ -106,6 +106,8 @@ stages: projects: "$(TestProjects)" arguments: '--configuration $(BuildConfiguration) --report-xunit-trx --coverage --coverage-output-format cobertura -- --filter-query "/[(Category=UnitTests)|(Mode=Readonly)]"' env: + AllowedOrigins__0: "5207" + ASPNETCORE_ENVIRONMENT: Development DOTNET_CLI_TELEMETRY_OPTOUT: 1 DOTNET_NOLOGO: 1 # - task: CmdLine@2 From 918a5919e442d4ccfdd131b4fd2bcc91f9cd09fe Mon Sep 17 00:00:00 2001 From: Bertrand THOMAS Date: Wed, 11 Mar 2026 18:22:54 +0100 Subject: [PATCH 6/6] Add vars --- .azure/pipelines/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.azure/pipelines/ci.yml b/.azure/pipelines/ci.yml index d0e04893..5f21c36d 100644 --- a/.azure/pipelines/ci.yml +++ b/.azure/pipelines/ci.yml @@ -107,6 +107,8 @@ stages: arguments: '--configuration $(BuildConfiguration) --report-xunit-trx --coverage --coverage-output-format cobertura -- --filter-query "/[(Category=UnitTests)|(Mode=Readonly)]"' env: AllowedOrigins__0: "5207" + Features__IsScalarEnabled: true + Features__IsHttpsRedirectionEnabled: false ASPNETCORE_ENVIRONMENT: Development DOTNET_CLI_TELEMETRY_OPTOUT: 1 DOTNET_NOLOGO: 1