Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 17 additions & 17 deletions .github/workflows/chapter-4-contracts-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

env:
CHAPTER_DIR: "Chapter-4-applying-tactical-domain-driven-design/Fitnet.Contracts/Src"
NUGET_SOURCE_NAME: "evolutionaryArchitecture"
NUGET_SOURCE_NAME: "EvolutionaryArchitecture"

jobs:
build:
Expand All @@ -27,14 +27,14 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x
- name: Add Evolutionary Architecture Nuget Source
uses: evolutionary-architecture/evolutionary-architecture-by-example/.github@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
owner: ${{ github.repository_owner }}
path: ${{ env.CHAPTER_DIR }}
nuget-source-name: ${{ env.NUGET_SOURCE_NAME }}
dotnet-version: 10.0.x
- name: Authenticate to GitHub Packages
run: |
dotnet nuget update source ${{ env.NUGET_SOURCE_NAME }} \
--username ${{ github.actor }} \
--password ${{ secrets.GITHUB_TOKEN }} \
--store-password-in-clear-text \
--configfile nuget.config
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand All @@ -52,14 +52,14 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 9.0.x
- name: Add Evolutionary Architecture Nuget Source
uses: evolutionary-architecture/evolutionary-architecture-by-example/.github@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
owner: ${{ github.repository_owner }}
path: ${{ env.CHAPTER_DIR }}
nuget-source-name: ${{ env.NUGET_SOURCE_NAME }}
dotnet-version: 10.0.x
- name: Authenticate to GitHub Packages
run: |
dotnet nuget update source ${{ env.NUGET_SOURCE_NAME }} \
--username ${{ github.actor }} \
--password ${{ secrets.GITHUB_TOKEN }} \
--store-password-in-clear-text \
--configfile nuget.config
- name: Restore dependencies
run: dotnet restore
- name: Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<AssemblyName>EvolutionaryArchitecture.$(MSBuildProjectName)</AssemblyName>
<RootNamespace>$(AssemblyName)</RootNamespace>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<AnalysisLevel>latest</AnalysisLevel>
<CodeAnalysisTreatWarningsAsErrors>true</CodeAnalysisTreatWarningsAsErrors>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup Label="Production">
<PackageVersion Include="ErrorOr" Version="2.0.1" />
<PackageVersion Include="EvolutionaryArchitecture.Fitnet.Common.Api" Version="4.2.0" />
<PackageVersion Include="EvolutionaryArchitecture.Fitnet.Common.Core" Version="4.2.0" />
<PackageVersion Include="EvolutionaryArchitecture.Fitnet.Common.Infrastructure" Version="4.2.0" />
<PackageVersion Include="EvolutionaryArchitecture.Fitnet.Common.IntegrationTestsToolbox" Version="4.2.0" />
<PackageVersion Include="Aspire.Hosting.AppHost" Version="13.0.0" />
<PackageVersion Include="Aspire.Hosting.PostgreSQL" Version="13.0.0" />
<PackageVersion Include="Aspire.Hosting.RabbitMQ" Version="13.0.0" />
<PackageVersion Include="JetBrains.Annotations" Version="2025.2.2" />
<PackageVersion Include="MassTransit.Abstractions" Version="8.3.2" />
<PackageVersion Include="MassTransit" Version="8.3.2" />
<PackageVersion Include="MassTransit.RabbitMQ" Version="8.3.2" />
<PackageVersion Include="MediatR" Version="12.5.0" />
<PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.0" />
<PackageVersion Include="Microsoft.AspNetCore.OpenApi" Version="10.0.1" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="10.0.1" />
<PackageVersion Include="Microsoft.OpenApi" Version="2.3.0" />
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.0" />
<PackageVersion Include="Swashbuckle.AspNetCore" Version="10.0.1" />
</ItemGroup>
<ItemGroup Label="Tests">
<PackageVersion Include="Bogus" Version="35.6.3" />
<PackageVersion Include="BouncyCastle.Cryptography" Version="2.4.0" />
<PackageVersion Include="EvolutionaryArchitecture.Fitnet.Common.UnitTesting" Version="4.2.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
<PackageVersion Include="Shouldly" Version="4.3.0" />
<PackageVersion Include="xunit" Version="2.9.3" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageVersion Include="xunit.analyzers" Version="1.24.0" />
<PackageVersion Include="xunit.categories" Version="2.0.8" />
</ItemGroup>
<ItemGroup>
<GlobalPackageReference Include="SonarAnalyzer.CSharp" Version="10.15.0.120848" PrivateAssets="all" Condition="$(MSBuildProjectExtension) == '.csproj'" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="Bogus" Version="35.6.1" />
<PackageReference Include="Shouldly" Version="4.3.0" />
<PackageReference Include="JetBrains.Annotations" Version="2024.3.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.analyzers" Version="1.18.0">
<PackageReference Include="Bogus" />
<PackageReference Include="Shouldly" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit.categories" Version="2.0.8" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.0">
<PackageReference Include="xunit.categories" />
<PackageReference Include="xunit.runner.visualstudio">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="coverlet.collector">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
namespace EvolutionaryArchitecture.Fitnet.Contracts.Api.UnitTests.SignContract.Signatures;

using EvolutionaryArchitecture.Fitnet.Contracts.Core.SignContract.Signatures;
using Core.SignContract.Signatures.Exceptions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ internal static void MapAttachAnnexToBindingContract(this IEndpointRouteBuilder
await contractsModule.ExecuteCommandAsync(request.ToCommand(id), cancellationToken)
.Match(annexId => Results.Created(BuildUrl(id, annexId), annexId),
errors => errors.ToProblem()))
.WithOpenApi(operation => new(operation)
{
Summary = "Attach annex to existing binding contract",
Description = "This endpoint is used to attach an annex to an existing binding contract.",
})
.WithSummary("Attach annex to existing binding contract")
.WithDescription("This endpoint is used to attach an annex to an existing binding contract.")
.Produces<string>(StatusCodes.Status201Created)
.Produces(StatusCodes.Status404NotFound)
.Produces(StatusCodes.Status409Conflict)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">

<ItemGroup>
<ProjectReference Include="..\Fitnet.Contracts.Core\Fitnet.Contracts.Core.csproj" />
<ProjectReference Include="..\Fitnet.Contracts.Infrastructure\Fitnet.Contracts.Infrastructure.csproj" />
Expand All @@ -7,8 +8,6 @@

<ItemGroup>
<InternalsVisibleTo Include="EvolutionaryArchitecture.Fitnet.Contracts.IntegrationTests" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="EvolutionaryArchitecture.Fitnet.Contracts.Api.UnitTests" />
</ItemGroup>

Expand All @@ -17,7 +16,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@ await contractsModule.ExecuteCommandAsync(request.ToCommand(), cancellationToken
contractId => Results.Created(ContractsApiPaths.GetPreparedContractPath(contractId), (object?)contractId),
errors => errors.ToProblem()))
.ValidateRequest<PrepareContractRequest>()
.WithOpenApi(operation => new(operation)
{
Summary = "Triggers preparation of a new contract for new or existing customer",
Description =
"This endpoint is used to prepare a new contract for new and existing customers.",
})
.WithSummary("Triggers preparation of a new contract for new or existing customer")
.WithDescription("This endpoint is used to prepare a new contract for new and existing customers.")
.Produces<string>(StatusCodes.Status201Created)
.Produces(StatusCodes.Status409Conflict)
.Produces(StatusCodes.Status500InternalServerError);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,8 @@ await contractsModule
bindingContractId => Results.Created($"/{ContractsApiPaths.BindingContracts}/{bindingContractId}",
bindingContractId), errors => errors.ToProblem()))
.ValidateRequest<SignContractRequestValidator>()
.WithOpenApi(operation => new(operation)
{
Summary = "Signs prepared contract",
Description =
"This endpoint is used to sign prepared contract by customer.",
})
.WithSummary("Signs prepared contract")
.WithDescription("This endpoint is used to sign prepared contract by customer.")
.Produces(StatusCodes.Status201Created)
.Produces(StatusCodes.Status404NotFound)
.Produces(StatusCodes.Status409Conflict)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ await contractsModule.ExecuteCommandAsync(new TerminateBindingContractCommand(bi
.Match(
_ => Results.NoContent(),
errors => errors.ToProblem()))
.WithOpenApi(operation => new(operation)
{
Summary = "Terminates binding contract",
Description = "This endpoint is used to terminate an existing binding contract."
})
.WithSummary("Terminates binding contract")
.WithDescription("This endpoint is used to terminate an existing binding contract.")
.Produces(StatusCodes.Status204NoContent)
.Produces(StatusCodes.Status404NotFound)
.Produces(StatusCodes.Status409Conflict)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ internal static void MapTerminateContract(this IEndpointRouteBuilder app) => app

return response;
})
.WithOpenApi(operation => new(operation)
{
Summary = "Terminate Binding Contract",
Description = "This endpoint is used to terminate a binding contract by invoking a termination.",
})
.WithSummary("Terminate Binding Contract")
.WithDescription("This endpoint is used to terminate a binding contract by invoking a termination.")
.Produces(StatusCodes.Status204NoContent)
.Produces(StatusCodes.Status404NotFound)
.Produces(StatusCodes.Status409Conflict)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<ItemGroup>
<PackageReference Include="ErrorOr" Version="2.0.1" />
<PackageReference Include="EvolutionaryArchitecture.Fitnet.Common.Api" Version="4.1.6" />
<PackageReference Include="EvolutionaryArchitecture.Fitnet.Contracts.IntegrationEvents" Version="1.0.7" />
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageReference Include="MassTransit.Abstractions" Version="8.3.4" />
<PackageReference Include="MediatR" Version="12.3.0" />
<PackageReference Include="ErrorOr" />
<PackageReference Include="EvolutionaryArchitecture.Fitnet.Common.Api" />
<PackageReference Include="JetBrains.Annotations" />
<PackageReference Include="MassTransit.Abstractions" />
<PackageReference Include="MediatR" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Fitnet.Contracts.Core\Fitnet.Contracts.Core.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

public interface IBindingContractsRepository
{
Task<ErrorOr<BindingContract>> GetByIdAsync(Guid bindingContract, CancellationToken cancellationToken = default);
Task<ErrorOr<BindingContract>> GetByIdAsync(Guid bindingContractId, CancellationToken cancellationToken = default);
Task AddAsync(BindingContract bindingContract, CancellationToken cancellationToken = default);
Task CommitAsync(CancellationToken cancellationToken = default);
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ internal void

[Fact]
internal void
#pragma warning disable S4144
Given_attach_annex_When_annex_valid_from_is_equal_to_binding_contract_expired_Then_it_is_possible_to_attach()
#pragma warning restore S4144
{
// Arrange
var bindingContractExpiringAt = _now;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EvolutionaryArchitecture.Fitnet.Contracts.Core.UnitTests.Common;

using DomainDrivenDesign.BuildingBlocks;
using Fitnet.Common.Core;

internal static class EntityExtensions
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Bogus" Version="35.6.1" />
<PackageReference Include="EvolutionaryArchitecture.Fitnet.Common.Core" Version="4.1.7" />
<PackageReference Include="EvolutionaryArchitecture.Fitnet.Common.UnitTesting" Version="4.1.7" />
<PackageReference Include="Shouldly" Version="4.3.0" />
<PackageReference Include="xunit" Version="2.8.1" />
<PackageReference Include="xunit.analyzers" Version="1.14.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PackageReference Include="Bogus" />
<PackageReference Include="EvolutionaryArchitecture.Fitnet.Common.Core" />
<PackageReference Include="EvolutionaryArchitecture.Fitnet.Common.UnitTesting" />
<PackageReference Include="Shouldly" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.analyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit.categories" Version="2.0.8" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.1">
<PackageReference Include="xunit.categories" />
<PackageReference Include="xunit.runner.visualstudio">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageReference Include="coverlet.collector" Version="6.0.2">
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="coverlet.collector">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace EvolutionaryArchitecture.Fitnet.Contracts.Core;

using AttachAnnexToBindingContract;
using DomainDrivenDesign.BuildingBlocks;
using Common.Core;

public sealed class Annex : Entity
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EvolutionaryArchitecture.Fitnet.Contracts.Core.AttachAnnexToBindingContract;

using DomainDrivenDesign.BuildingBlocks;
using Common.Core;

public sealed record AnnexAttachedToBindingContractEvent(
Guid Id,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace EvolutionaryArchitecture.Fitnet.Contracts.Core;

using AttachAnnexToBindingContract.BusinessRules;
using Common.Core;
using Common.Core.BussinessRules;
using DomainDrivenDesign.BuildingBlocks;
using SignContract;
using TerminateBindingContract;
using TerminateBindingContract.BusinessRules;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
namespace EvolutionaryArchitecture.Fitnet.Contracts.Core;

using Common.Core;
using Common.Core.BussinessRules;
using DomainDrivenDesign.BuildingBlocks;
using PrepareContract;
using PrepareContract.BusinessRules;
using SignContract.BusinessRules;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="ErrorOr" Version="2.0.1" />
<PackageReference Include="EvolutionaryArchitecture.Fitnet.Common.Core" Version="4.1.6" />
<PackageReference Include="EvolutionaryArchitecture.Fitnet.DomainDrivenDesign.BuildingBlocks" Version="1.2.1" />
<PackageReference Include="ErrorOr" />
<PackageReference Include="EvolutionaryArchitecture.Fitnet.Common.Core" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EvolutionaryArchitecture.Fitnet.Contracts.Core.PrepareContract;

using DomainDrivenDesign.BuildingBlocks;
using Common.Core;

public sealed record ContractPreparedEvent(
Guid Id,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EvolutionaryArchitecture.Fitnet.Contracts.Core.SignContract;

using DomainDrivenDesign.BuildingBlocks;
using Common.Core;

public sealed record BindingContractStartedEvent(
Guid Id,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace EvolutionaryArchitecture.Fitnet.Contracts.Core.TerminateBindingContract;

using DomainDrivenDesign.BuildingBlocks;
using Common.Core;

public sealed record BindingContractTerminatedEvent(
Guid Id,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#nullable disable

namespace EvolutionaryArchitecture.Fitnet.Contracts.Data.Database.Migrations;

using System;
using Microsoft.EntityFrameworkCore.Migrations;

Expand Down
Loading