Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refac: 1. refactor archived messages to clean architecture #1358

Merged
Show file tree
Hide file tree
Changes from 6 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
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Energinet.DataHub.EDI.ArchivedMessages.Application</AssemblyName>
<RootNamespace>Energinet.DataHub.EDI.ArchivedMessages.Application</RootNamespace>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="8.0.0" />
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.11.20">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ArchivedMessages.Infrastructure\ArchivedMessages.Infrastructure.csproj" />
<ProjectReference Include="..\ArchivedMessages.Interfaces\ArchivedMessages.Interfaces.csproj" />
<ProjectReference Include="..\BuildingBlocks.Application\BuildingBlocks.Application.csproj" />
<ProjectReference Include="..\DataAccess\DataAccess.csproj" />
<ProjectReference Include="..\BuildingBlocks.Domain\BuildingBlocks.Domain.csproj" />
</ItemGroup>
<ItemDefinitionGroup>
<ProjectReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using Energinet.DataHub.EDI.ArchivedMessages.Infrastructure;
using Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
using Energinet.DataHub.EDI.ArchivedMessages.Interfaces.Models;
using Energinet.DataHub.EDI.BuildingBlocks.Domain.Models;

namespace Energinet.DataHub.EDI.ArchivedMessages.Application;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using System.Text.RegularExpressions;
using Dapper;
using Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
using Energinet.DataHub.EDI.ArchivedMessages.Interfaces.Models;
using Energinet.DataHub.EDI.BuildingBlocks.Domain.Authentication;
using Energinet.DataHub.EDI.BuildingBlocks.Domain.Models;
using Energinet.DataHub.EDI.BuildingBlocks.Infrastructure.DataAccess;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>Energinet.DataHub.EDI.ArchivedMessages.Infrastructure</AssemblyName>
Expand All @@ -15,9 +15,12 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ArchivedMessages.Application\ArchivedMessages.Application.csproj" />
<ProjectReference Include="..\ArchivedMessages.Interfaces\ArchivedMessages.Interfaces.csproj" />
<ProjectReference Include="..\BuildingBlocks.Application\BuildingBlocks.Application.csproj" />
<ProjectReference Include="..\BuildingBlocks.Domain\BuildingBlocks.Domain.csproj" />
<ProjectReference Include="..\BuildingBlocks.Infrastructure\BuildingBlocks.Infrastructure.csproj" />
<ProjectReference Include="..\DataAccess\DataAccess.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
// limitations under the License.

using BuildingBlocks.Application.Extensions.DependencyInjection;
using Energinet.DataHub.EDI.ArchivedMessages.Infrastructure;
using Energinet.DataHub.EDI.ArchivedMessages.Application;
using Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
using Energinet.DataHub.EDI.DataAccess.Extensions.DependencyInjection;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;

namespace Energinet.DataHub.EDI.ArchivedMessages.Application.Extensions.DependencyInjection;
namespace Energinet.DataHub.EDI.ArchivedMessages.Infrastructure.Extensions.DependencyInjection;

public static class ArchivedMessageExtensions
{
Expand Down
2 changes: 1 addition & 1 deletion source/ArchivedMessages.Infrastructure/QueryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

using Dapper;
using Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
using Energinet.DataHub.EDI.ArchivedMessages.Interfaces.Models;
using Energinet.DataHub.EDI.BuildingBlocks.Domain.Authentication;
using Energinet.DataHub.EDI.BuildingBlocks.Domain.Exceptions;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ limitations under the License.
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ArchivedMessages.Application\ArchivedMessages.Application.csproj" />
<ProjectReference Include="..\ArchivedMessages.Infrastructure\ArchivedMessages.Infrastructure.csproj" />
<ProjectReference Include="..\ArchivedMessages.Interfaces\ArchivedMessages.Interfaces.csproj" />
<ProjectReference Include="..\BuildingBlocks.Domain\BuildingBlocks.Domain.csproj" />
<ProjectReference Include="..\BuildingBlocks.Tests\BuildingBlocks.Tests.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

using Energinet.DataHub.EDI.ArchivedMessages.IntegrationTests.Fixture;
using Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
using Energinet.DataHub.EDI.ArchivedMessages.Interfaces.Models;
using Energinet.DataHub.EDI.BuildingBlocks.Domain.Authentication;
using Energinet.DataHub.EDI.BuildingBlocks.Domain.Models;
using FluentAssertions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
using System.Reflection;
using Energinet.DataHub.EDI.ArchivedMessages.IntegrationTests.Fixture;
using Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
using Energinet.DataHub.EDI.ArchivedMessages.Interfaces.Models;
using Energinet.DataHub.EDI.BuildingBlocks.Domain.Authentication;
using Energinet.DataHub.EDI.BuildingBlocks.Domain.Models;
using FluentAssertions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,20 @@

using Azure.Storage.Blobs;
using Dapper;
using Energinet.DataHub.BuildingBlocks.Tests;
using Energinet.DataHub.BuildingBlocks.Tests.Database;
using Energinet.DataHub.BuildingBlocks.Tests.Logging;
using Energinet.DataHub.Core.FunctionApp.TestCommon.Azurite;
using Energinet.DataHub.Core.Messaging.Communication.Extensions.Options;
using Energinet.DataHub.EDI.ArchivedMessages.Application.Extensions.DependencyInjection;
using Energinet.DataHub.EDI.ArchivedMessages.Infrastructure.Extensions.DependencyInjection;
using Energinet.DataHub.EDI.ArchivedMessages.IntegrationTests.Models;
using Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
using Energinet.DataHub.EDI.ArchivedMessages.Interfaces.Models;
using Energinet.DataHub.EDI.BuildingBlocks.Domain.Authentication;
using Energinet.DataHub.EDI.BuildingBlocks.Domain.Models;
using Energinet.DataHub.EDI.BuildingBlocks.Infrastructure.DataAccess;
using Energinet.DataHub.EDI.BuildingBlocks.Infrastructure.FileStorage;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using NodaTime;
using Xunit;
using Xunit.Abstractions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
using Energinet.DataHub.EDI.ArchivedMessages.Interfaces.Models;
using NodaTime;

namespace Energinet.DataHub.EDI.ArchivedMessages.IntegrationTests.Models;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Energinet.DataHub.EDI.ArchivedMessages.Interfaces</AssemblyName>
<RootNamespace>Energinet.DataHub.EDI.ArchivedMessages.Interfaces</RootNamespace>
Expand All @@ -15,7 +15,7 @@
</ItemGroup>
<!--Giving the integration test project of ArchivedMessages access to internals -->
<ItemGroup>
<InternalsVisibleTo Include="Energinet.DataHub.EDI.ArchivedMessages.IntegrationTests"/>
<InternalsVisibleTo Include="Energinet.DataHub.EDI.ArchivedMessages.IntegrationTests" />
</ItemGroup>
<ItemDefinitionGroup>
<ProjectReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
using Energinet.DataHub.EDI.ArchivedMessages.Interfaces.Models;

namespace Energinet.DataHub.EDI.ArchivedMessages.Infrastructure;
namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
AndersBallingPetersen marked this conversation as resolved.
Show resolved Hide resolved

/// <summary>
/// Responsible for archiving messages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

using Energinet.DataHub.EDI.ArchivedMessages.Interfaces.Models;
using Energinet.DataHub.EDI.BuildingBlocks.Domain.Models;

namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
using Energinet.DataHub.EDI.BuildingBlocks.Domain.Models;
using NodaTime;

namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces.Models;

public class ArchivedMessage
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces.Models;

public record ArchivedMessageId(Guid Value)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

using Energinet.DataHub.EDI.BuildingBlocks.Domain.Models;

namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces.Models;

#pragma warning disable CA1711 // Is a "Stream" value type
public sealed record ArchivedMessageStream : StreamValueObject, IArchivedMessageStream
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces.Models;

public enum ArchivedMessageType
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces.Models;

public readonly struct FieldToSortBy
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces.Models;

/// <summary>
/// Represents a query options for retrieving messages.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@

using NodaTime;

namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces.Models;

public record MessageCreationPeriod(Instant DateToSearchFrom, Instant DateToSearchTo);
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

using NodaTime;

namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces.Models;

public record MessageInfo(
long RecordId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@

using System.Collections.ObjectModel;

namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces.Models;

public record MessageSearchResult(ReadOnlyCollection<MessageInfo> Messages, int TotalAmountOfMessages);
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces.Models;

public readonly struct DirectionToSortBy
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
namespace Energinet.DataHub.EDI.ArchivedMessages.Interfaces.Models;

/// <summary>
/// The SortedCursorBasedPagination is navigating forward or backwards through a dataset
Expand Down
4 changes: 2 additions & 2 deletions source/B2BApi/B2BApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ limitations under the License.
<PackageReference Include="System.Text.Json" Version="8.0.5" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ArchivedMessages.Application\ArchivedMessages.Application.csproj" />
<ProjectReference Include="..\ArchivedMessages.Infrastructure\ArchivedMessages.Infrastructure.csproj" />
<ProjectReference Include="..\AuditLog\AuditLog.csproj" />
<ProjectReference Include="..\BuildingBlocks.Application\BuildingBlocks.Application.csproj" />
<ProjectReference Include="..\CalculationResults\CalculationResults.Infrastructure\CalculationResults.Infrastructure.csproj" />
Expand All @@ -60,7 +60,7 @@ limitations under the License.
<ProjectReference Include="..\IncomingMessages.Interfaces\IncomingMessages.Interfaces.csproj" />
<ProjectReference Include="..\IntegrationEvents.Application\IntegrationEvents.Application.csproj" />
<ProjectReference Include="..\IntegrationEvents.Infrastructure\IntegrationEvents.Infrastructure.csproj" />
<ProjectReference Include="..\MasterData.Application\MasterData.Application.csproj" />
<ProjectReference Include="..\MasterData.Infrastructure\MasterData.Infrastructure.csproj" />
<ProjectReference Include="..\MasterData.Interfaces\MasterData.Interfaces.csproj" />
<ProjectReference Include="..\Outbox.Infrastructure\Outbox.Infrastructure.csproj" />
<ProjectReference Include="..\OutgoingMessages.Application\OutgoingMessages.Application.csproj" />
Expand Down
4 changes: 2 additions & 2 deletions source/B2BApi/HostFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@
using Energinet.DataHub.Core.App.FunctionApp.Extensions.Builder;
using Energinet.DataHub.Core.App.FunctionApp.Extensions.DependencyInjection;
using Energinet.DataHub.Core.Outbox.Extensions.DependencyInjection;
using Energinet.DataHub.EDI.ArchivedMessages.Application.Extensions.DependencyInjection;
using Energinet.DataHub.EDI.ArchivedMessages.Infrastructure.Extensions.DependencyInjection;
using Energinet.DataHub.EDI.AuditLog;
using Energinet.DataHub.EDI.B2BApi.Configuration.Middleware;
using Energinet.DataHub.EDI.B2BApi.Configuration.Middleware.Authentication;
using Energinet.DataHub.EDI.B2BApi.Extensions.DependencyInjection;
using Energinet.DataHub.EDI.DataAccess.UnitOfWork.Extensions.DependencyInjection;
using Energinet.DataHub.EDI.IncomingMessages.Application.Extensions.DependencyInjection;
using Energinet.DataHub.EDI.IntegrationEvents.Application.Extensions.DependencyInjection;
using Energinet.DataHub.EDI.MasterData.Application.Extensions.DependencyInjection;
using Energinet.DataHub.EDI.MasterData.Infrastructure.Extensions.DependencyInjection;
using Energinet.DataHub.EDI.Outbox.Infrastructure;
using Energinet.DataHub.EDI.OutgoingMessages.Application.Extensions.DependencyInjection;
using Energinet.DataHub.EDI.Process.Application.Extensions.DependencyInjection;
Expand Down
36 changes: 18 additions & 18 deletions source/B2CWebApi/B2CWebApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,33 +8,33 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Energinet.DataHub.Core.App.WebApp" Version="13.2.0"/>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.8"/>
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0"/>
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="2.13.6"/>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0"/>
<PackageReference Include="Microsoft.OpenApi" Version="1.6.22"/>
<PackageReference Include="Energinet.DataHub.Core.App.WebApp" Version="13.2.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.8" />
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="2.13.6" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageReference Include="Microsoft.OpenApi" Version="1.6.22" />
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers" Version="17.11.20">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.3"/>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.3" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\ArchivedMessages.Application\ArchivedMessages.Application.csproj"/>
<ProjectReference Include="..\ArchivedMessages.Interfaces\ArchivedMessages.Interfaces.csproj"/>
<ProjectReference Include="..\AuditLog\AuditLog.csproj"/>
<ProjectReference Include="..\BuildingBlocks.Application\BuildingBlocks.Application.csproj"/>
<ProjectReference Include="..\BuildingBlocks.Domain\BuildingBlocks.Domain.csproj"/>
<ProjectReference Include="..\DataAccess.UnitOfWork\DataAccess.UnitOfWork.csproj"/>
<ProjectReference Include="..\IncomingMessages.Application\IncomingMessages.Application.csproj"/>
<ProjectReference Include="..\IncomingMessages.Interfaces\IncomingMessages.Interfaces.csproj"/>
<ProjectReference Include="..\ArchivedMessages.Infrastructure\ArchivedMessages.Infrastructure.csproj" />
<ProjectReference Include="..\ArchivedMessages.Interfaces\ArchivedMessages.Interfaces.csproj" />
<ProjectReference Include="..\AuditLog\AuditLog.csproj" />
<ProjectReference Include="..\BuildingBlocks.Application\BuildingBlocks.Application.csproj" />
<ProjectReference Include="..\BuildingBlocks.Domain\BuildingBlocks.Domain.csproj" />
<ProjectReference Include="..\DataAccess.UnitOfWork\DataAccess.UnitOfWork.csproj" />
<ProjectReference Include="..\IncomingMessages.Application\IncomingMessages.Application.csproj" />
<ProjectReference Include="..\IncomingMessages.Interfaces\IncomingMessages.Interfaces.csproj" />
<!--PLEASE DO NOT REMOVE THE REFERENCE TO INCOMINGMESSAGES.INFRASTRUCTURE! DOING SO WILL BREAK THE SCHEMA LOOKUP!-->
<ProjectReference Include="..\IncomingMessages.Infrastructure\IncomingMessages.Infrastructure.csproj"/>
<ProjectReference Include="..\IncomingMessages.Infrastructure\IncomingMessages.Infrastructure.csproj" />
<!--READ THE COMMENT ABOVE-->
<ProjectReference Include="..\MasterData.Application\MasterData.Application.csproj"/>
<ProjectReference Include="..\Outbox.Infrastructure\Outbox.Infrastructure.csproj"/>
<ProjectReference Include="..\MasterData.Infrastructure\MasterData.Infrastructure.csproj" />
<ProjectReference Include="..\Outbox.Infrastructure\Outbox.Infrastructure.csproj" />
</ItemGroup>

<ItemDefinitionGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// limitations under the License.

using Energinet.DataHub.EDI.ArchivedMessages.Interfaces;
using Energinet.DataHub.EDI.AuditLog;
using Energinet.DataHub.EDI.ArchivedMessages.Interfaces.Models;
using Energinet.DataHub.EDI.AuditLog.AuditLogger;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Mvc;
Expand Down
Loading
Loading