Merge branch 'feature/waiter-floor-bff-boundary' into development
This commit is contained in:
commit
fb0f08bd31
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
.tasks/
|
||||
.agile/
|
||||
**/bin/
|
||||
**/obj/
|
||||
|
||||
10
Directory.Build.props
Normal file
10
Directory.Build.props
Normal file
@ -0,0 +1,10 @@
|
||||
<Project>
|
||||
<PropertyGroup>
|
||||
<Authors>AgileWebs</Authors>
|
||||
<Company>AgileWebs</Company>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<RepositoryUrl>http://192.168.68.156:3000/AgileWebs/waiter-floor-bff</RepositoryUrl>
|
||||
<PackageProjectUrl>http://192.168.68.156:3000/AgileWebs/waiter-floor-bff</PackageProjectUrl>
|
||||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
7
Waiter.Floor.Bff.slnx
Normal file
7
Waiter.Floor.Bff.slnx
Normal file
@ -0,0 +1,7 @@
|
||||
<Solution>
|
||||
<Folder Name="/src/">
|
||||
<Project Path="src/Waiter.Floor.Bff.Application/Waiter.Floor.Bff.Application.csproj" />
|
||||
<Project Path="src/Waiter.Floor.Bff.Contracts/Waiter.Floor.Bff.Contracts.csproj" />
|
||||
<Project Path="src/Waiter.Floor.Bff.Rest/Waiter.Floor.Bff.Rest.csproj" />
|
||||
</Folder>
|
||||
</Solution>
|
||||
@ -0,0 +1,12 @@
|
||||
using Waiter.Floor.Bff.Contracts.Requests;
|
||||
using Waiter.Floor.Bff.Contracts.Responses;
|
||||
|
||||
namespace Waiter.Floor.Bff.Application.Adapters;
|
||||
|
||||
public sealed class DefaultWaiterServiceClient : IWaiterServiceClient
|
||||
{
|
||||
public Task<GetWaiterAssignmentsResponse> FetchAsync(GetWaiterAssignmentsRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
return Task.FromResult(new GetWaiterAssignmentsResponse(request.ContextId, "Default service-backed response."));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
using Waiter.Floor.Bff.Contracts.Requests;
|
||||
using Waiter.Floor.Bff.Contracts.Responses;
|
||||
|
||||
namespace Waiter.Floor.Bff.Application.Adapters;
|
||||
|
||||
public interface IWaiterServiceClient
|
||||
{
|
||||
Task<GetWaiterAssignmentsResponse> FetchAsync(GetWaiterAssignmentsRequest request, CancellationToken cancellationToken);
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
using Waiter.Floor.Bff.Application.Adapters;
|
||||
using Waiter.Floor.Bff.Contracts.Requests;
|
||||
using Waiter.Floor.Bff.Contracts.Responses;
|
||||
|
||||
namespace Waiter.Floor.Bff.Application.Handlers;
|
||||
|
||||
public sealed class GetWaiterAssignmentsHandler(IWaiterServiceClient serviceClient) : IGetWaiterAssignmentsHandler
|
||||
{
|
||||
public Task<GetWaiterAssignmentsResponse> HandleAsync(GetWaiterAssignmentsRequest request, CancellationToken cancellationToken)
|
||||
{
|
||||
return serviceClient.FetchAsync(request, cancellationToken);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
using Waiter.Floor.Bff.Contracts.Requests;
|
||||
using Waiter.Floor.Bff.Contracts.Responses;
|
||||
|
||||
namespace Waiter.Floor.Bff.Application.Handlers;
|
||||
|
||||
public interface IGetWaiterAssignmentsHandler
|
||||
{
|
||||
Task<GetWaiterAssignmentsResponse> HandleAsync(GetWaiterAssignmentsRequest request, CancellationToken cancellationToken);
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Waiter.Floor.Bff.Contracts\Waiter.Floor.Bff.Contracts.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -0,0 +1,3 @@
|
||||
namespace Waiter.Floor.Bff.Contracts.Requests;
|
||||
|
||||
public sealed record GetWaiterAssignmentsRequest(string ContextId);
|
||||
@ -0,0 +1,3 @@
|
||||
namespace Waiter.Floor.Bff.Contracts.Responses;
|
||||
|
||||
public sealed record GetWaiterAssignmentsResponse(string ContextId, string Summary);
|
||||
@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
17
src/Waiter.Floor.Bff.Rest/Program.cs
Normal file
17
src/Waiter.Floor.Bff.Rest/Program.cs
Normal file
@ -0,0 +1,17 @@
|
||||
using Waiter.Floor.Bff.Application.Adapters;
|
||||
using Waiter.Floor.Bff.Application.Handlers;
|
||||
using Waiter.Floor.Bff.Contracts.Requests;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddSingleton<IWaiterServiceClient, DefaultWaiterServiceClient>();
|
||||
builder.Services.AddSingleton<IGetWaiterAssignmentsHandler, GetWaiterAssignmentsHandler>();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.MapGet("/api/waiter/floor/assignments", async (string contextId, IGetWaiterAssignmentsHandler handler, CancellationToken ct) =>
|
||||
{
|
||||
var request = new GetWaiterAssignmentsRequest(contextId);
|
||||
return Results.Ok(await handler.HandleAsync(request, ct));
|
||||
});
|
||||
|
||||
app.Run();
|
||||
23
src/Waiter.Floor.Bff.Rest/Properties/launchSettings.json
Normal file
23
src/Waiter.Floor.Bff.Rest/Properties/launchSettings.json
Normal 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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
13
src/Waiter.Floor.Bff.Rest/Waiter.Floor.Bff.Rest.csproj
Normal file
13
src/Waiter.Floor.Bff.Rest/Waiter.Floor.Bff.Rest.csproj
Normal 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="..\Waiter.Floor.Bff.Application\Waiter.Floor.Bff.Application.csproj" />
|
||||
<ProjectReference Include="..\Waiter.Floor.Bff.Contracts\Waiter.Floor.Bff.Contracts.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
8
src/Waiter.Floor.Bff.Rest/appsettings.Development.json
Normal file
8
src/Waiter.Floor.Bff.Rest/appsettings.Development.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
9
src/Waiter.Floor.Bff.Rest/appsettings.json
Normal file
9
src/Waiter.Floor.Bff.Rest/appsettings.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user