Merge branch 'feature/customer-orders-bff-boundary' into development

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

2
.gitignore vendored
View File

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

7
Customer.Orders.Bff.slnx Normal file
View File

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

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/customer-orders-bff</RepositoryUrl>
<PackageProjectUrl>http://192.168.68.156:3000/AgileWebs/customer-orders-bff</PackageProjectUrl>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
</PropertyGroup>
</Project>

View File

@ -0,0 +1,12 @@
using Customer.Orders.Bff.Contracts.Requests;
using Customer.Orders.Bff.Contracts.Responses;
namespace Customer.Orders.Bff.Application.Adapters;
public sealed class DefaultCustomerOrdersServiceClient : ICustomerOrdersServiceClient
{
public Task<GetCustomerOrderStatusResponse> FetchAsync(GetCustomerOrderStatusRequest request, CancellationToken cancellationToken)
{
return Task.FromResult(new GetCustomerOrderStatusResponse(request.ContextId, "Default service-backed response."));
}
}

View File

@ -0,0 +1,9 @@
using Customer.Orders.Bff.Contracts.Requests;
using Customer.Orders.Bff.Contracts.Responses;
namespace Customer.Orders.Bff.Application.Adapters;
public interface ICustomerOrdersServiceClient
{
Task<GetCustomerOrderStatusResponse> FetchAsync(GetCustomerOrderStatusRequest 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="..\Customer.Orders.Bff.Contracts\Customer.Orders.Bff.Contracts.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,13 @@
using Customer.Orders.Bff.Application.Adapters;
using Customer.Orders.Bff.Contracts.Requests;
using Customer.Orders.Bff.Contracts.Responses;
namespace Customer.Orders.Bff.Application.Handlers;
public sealed class GetCustomerOrderStatusHandler(ICustomerOrdersServiceClient serviceClient) : IGetCustomerOrderStatusHandler
{
public Task<GetCustomerOrderStatusResponse> HandleAsync(GetCustomerOrderStatusRequest request, CancellationToken cancellationToken)
{
return serviceClient.FetchAsync(request, cancellationToken);
}
}

View File

@ -0,0 +1,9 @@
using Customer.Orders.Bff.Contracts.Requests;
using Customer.Orders.Bff.Contracts.Responses;
namespace Customer.Orders.Bff.Application.Handlers;
public interface IGetCustomerOrderStatusHandler
{
Task<GetCustomerOrderStatusResponse> HandleAsync(GetCustomerOrderStatusRequest request, CancellationToken cancellationToken);
}

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 Customer.Orders.Bff.Contracts.Requests;
public sealed record GetCustomerOrderStatusRequest(string ContextId);

View File

@ -0,0 +1,3 @@
namespace Customer.Orders.Bff.Contracts.Responses;
public sealed record GetCustomerOrderStatusResponse(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="..\Customer.Orders.Bff.Application\Customer.Orders.Bff.Application.csproj" />
<ProjectReference Include="..\Customer.Orders.Bff.Contracts\Customer.Orders.Bff.Contracts.csproj" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,17 @@
using Customer.Orders.Bff.Application.Adapters;
using Customer.Orders.Bff.Application.Handlers;
using Customer.Orders.Bff.Contracts.Requests;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSingleton<ICustomerOrdersServiceClient, DefaultCustomerOrdersServiceClient>();
builder.Services.AddSingleton<IGetCustomerOrderStatusHandler, GetCustomerOrderStatusHandler>();
var app = builder.Build();
app.MapGet("/api/customer/orders/status", async (string contextId, IGetCustomerOrderStatusHandler handler, CancellationToken ct) =>
{
var request = new GetCustomerOrderStatusRequest(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": "*"
}