Merge branch 'feature/pos-transactions-bff-boundary' into development

This commit is contained in:
José René White Enciso 2026-02-25 18:18:21 -06:00
commit 0e53d4dee2
16 changed files with 159 additions and 0 deletions

2
.gitignore vendored
View File

@ -1,2 +1,4 @@
.tasks/ .tasks/
.agile/ .agile/
**/bin/
**/obj/

10
Directory.Build.props Normal file
View File

@ -0,0 +1,10 @@
<Project>
<PropertyGroup>
<Authors>AgileWebs</Authors>
<Company>AgileWebs</Company>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>http://192.168.68.156:3000/AgileWebs/pos-transactions-bff</RepositoryUrl>
<PackageProjectUrl>http://192.168.68.156:3000/AgileWebs/pos-transactions-bff</PackageProjectUrl>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,7 @@
<Solution>
<Folder Name="/src/">
<Project Path="src/Pos.Transactions.Bff.Application/Pos.Transactions.Bff.Application.csproj" />
<Project Path="src/Pos.Transactions.Bff.Contracts/Pos.Transactions.Bff.Contracts.csproj" />
<Project Path="src/Pos.Transactions.Bff.Rest/Pos.Transactions.Bff.Rest.csproj" />
</Folder>
</Solution>

View File

@ -0,0 +1,12 @@
using Pos.Transactions.Bff.Contracts.Requests;
using Pos.Transactions.Bff.Contracts.Responses;
namespace Pos.Transactions.Bff.Application.Adapters;
public sealed class DefaultPosTransactionsServiceClient : IPosTransactionsServiceClient
{
public Task<GetPosTransactionSummaryResponse> FetchAsync(GetPosTransactionSummaryRequest request, CancellationToken cancellationToken)
{
return Task.FromResult(new GetPosTransactionSummaryResponse(request.ContextId, "Default service-backed response."));
}
}

View File

@ -0,0 +1,9 @@
using Pos.Transactions.Bff.Contracts.Requests;
using Pos.Transactions.Bff.Contracts.Responses;
namespace Pos.Transactions.Bff.Application.Adapters;
public interface IPosTransactionsServiceClient
{
Task<GetPosTransactionSummaryResponse> FetchAsync(GetPosTransactionSummaryRequest request, CancellationToken cancellationToken);
}

View File

@ -0,0 +1,13 @@
using Pos.Transactions.Bff.Application.Adapters;
using Pos.Transactions.Bff.Contracts.Requests;
using Pos.Transactions.Bff.Contracts.Responses;
namespace Pos.Transactions.Bff.Application.Handlers;
public sealed class GetPosTransactionSummaryHandler(IPosTransactionsServiceClient serviceClient) : IGetPosTransactionSummaryHandler
{
public Task<GetPosTransactionSummaryResponse> HandleAsync(GetPosTransactionSummaryRequest request, CancellationToken cancellationToken)
{
return serviceClient.FetchAsync(request, cancellationToken);
}
}

View File

@ -0,0 +1,9 @@
using Pos.Transactions.Bff.Contracts.Requests;
using Pos.Transactions.Bff.Contracts.Responses;
namespace Pos.Transactions.Bff.Application.Handlers;
public interface IGetPosTransactionSummaryHandler
{
Task<GetPosTransactionSummaryResponse> HandleAsync(GetPosTransactionSummaryRequest request, CancellationToken cancellationToken);
}

View File

@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Pos.Transactions.Bff.Contracts\Pos.Transactions.Bff.Contracts.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,3 @@
namespace Pos.Transactions.Bff.Contracts.Requests;
public sealed record GetPosTransactionSummaryRequest(string ContextId);

View File

@ -0,0 +1,3 @@
namespace Pos.Transactions.Bff.Contracts.Responses;
public sealed record GetPosTransactionSummaryResponse(string ContextId, string Summary);

View File

@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Pos.Transactions.Bff.Application\Pos.Transactions.Bff.Application.csproj" />
<ProjectReference Include="..\Pos.Transactions.Bff.Contracts\Pos.Transactions.Bff.Contracts.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,17 @@
using Pos.Transactions.Bff.Application.Adapters;
using Pos.Transactions.Bff.Application.Handlers;
using Pos.Transactions.Bff.Contracts.Requests;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSingleton<IPosTransactionsServiceClient, DefaultPosTransactionsServiceClient>();
builder.Services.AddSingleton<IGetPosTransactionSummaryHandler, GetPosTransactionSummaryHandler>();
var app = builder.Build();
app.MapGet("/api/pos/transactions/summary", async (string contextId, IGetPosTransactionSummaryHandler handler, CancellationToken ct) =>
{
var request = new GetPosTransactionSummaryRequest(contextId);
return Results.Ok(await handler.HandleAsync(request, ct));
});
app.Run();

View File

@ -0,0 +1,23 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:0",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:0;http://localhost:0",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}

View File

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}