Adds refactoring

This commit is contained in:
BinaryAlley committed 2024-08-26 23:32:38 +03:00
1 parent 8b729cc16c
commit ddfaaefa27
39 files changed
+673 -396

No files matched your search

@@ -1,7 +1,7 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.Enums;
using Lumina.Application.Common.Models.Books;
using Lumina.Application.Common.Models.Contributors;
using Lumina.Domain.Common.Enums;
#endregion
namespace Lumina.Presentation.Api.Common.Contracts.Books;
@@ -7,7 +7,7 @@ using Mapster;
namespace Lumina.Presentation.Api.Common.Mapping;
/// <summary>
/// Mapping configuration for books.
/// Mapping configuration for books between the API request object and the command object.
/// </summary>
public class BookMappingConfig : IRegister
{
@@ -1,5 +1,6 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Core.WrittenContentLibrary.BooksLibrary.Books.Commands;
using Lumina.Application.Core.WrittenContentLibrary.BooksLibrary.Books.Queries;
using Lumina.Presentation.Api.Common.Contracts.Books;
using Lumina.Presentation.Api.Controllers.Common;
using MapsterMapper;
@@ -41,9 +42,8 @@ public class BooksController : ApiController
[HttpGet()]
public async Task<IActionResult> GetBooks()
{
// ErrorOr<IEnumerable<BookDto>> result = await mediator.Send(new GetBooksQuery());
// return result.Match(result => Ok(result), errors => Problem(errors));
return Ok(new List<string> { "Book 1", "Book 2", "Book 3" });
var result = await _mediator.Send(new GetBooksQuery());
return result.Match(result => Ok(result), errors => Problem(errors));
}
/// <summary>
@@ -1,39 +1,44 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<BaseOutputPath>..\..\bin\</BaseOutputPath>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<BaseOutputPath>..\..\bin\</BaseOutputPath>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Mapster" Version="7.4.0" />
<PackageReference Include="Mapster.DependencyInjection" Version="1.0.1" />
<PackageReference Include="Mediator.Abstractions" Version="2.1.7" />
<PackageReference Include="Mediator.SourceGenerator" Version="2.1.7">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.1.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.7" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
</ItemGroup>
<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="appsettings.Development.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<DependentUpon>appsettings.shared.json</DependentUpon>
</None>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Mapster" Version="7.4.0" />
<PackageReference Include="Mapster.DependencyInjection" Version="1.0.1" />
<PackageReference Include="Mediator.Abstractions" Version="2.1.7" />
<PackageReference Include="Mediator.SourceGenerator" Version="2.1.7">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="5.1.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="5.1.0" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.8" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Lumina.Application\Lumina.Application.csproj" />
<ProjectReference Include="..\Lumina.Infrastructure\Lumina.Infrastructure.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="appsettings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="appsettings.Development.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<DependentUpon>appsettings.shared.json</DependentUpon>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Lumina.Application\Lumina.Application.csproj" />
<ProjectReference Include="..\Lumina.Infrastructure\Lumina.Infrastructure.csproj" />
<ProjectReference Include="..\Lumina.DataAccess\Lumina.DataAccess.csproj" />
</ItemGroup>
</Project>
+2
View File
@@ -2,6 +2,7 @@
using Lumina.Presentation.Api.Common.DependencyInjection;
using Lumina.Application.Common.DependencyInjection;
using Lumina.Infrastructure.Common.DependencyInjection;
using Lumina.DataAccess.Common.DependencyInjection;
#endregion
namespace Lumina.Presentation.Api;
@@ -26,6 +27,7 @@ public class Program
builder.Services.AddApplicationLayerServices();
builder.Services.AddPresentationApiLayerServices();
builder.Services.AddInfrastructureLayerServices();
builder.Services.AddDataAccessLayerServices();
var app = builder.Build();