diff --git a/.gitignore b/.gitignore index 31c7257..b299ff1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .tasks/ .agile/ +**/bin/ +**/obj/ diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..6c65e53 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,10 @@ + + + AgileWebs + AgileWebs + git + http://192.168.68.156:3000/AgileWebs/waiter-floor-bff + http://192.168.68.156:3000/AgileWebs/waiter-floor-bff + false + + diff --git a/Waiter.Floor.Bff.slnx b/Waiter.Floor.Bff.slnx new file mode 100644 index 0000000..f237148 --- /dev/null +++ b/Waiter.Floor.Bff.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/Waiter.Floor.Bff.Application/Adapters/DefaultWaiterServiceClient.cs b/src/Waiter.Floor.Bff.Application/Adapters/DefaultWaiterServiceClient.cs new file mode 100644 index 0000000..a722122 --- /dev/null +++ b/src/Waiter.Floor.Bff.Application/Adapters/DefaultWaiterServiceClient.cs @@ -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 FetchAsync(GetWaiterAssignmentsRequest request, CancellationToken cancellationToken) + { + return Task.FromResult(new GetWaiterAssignmentsResponse(request.ContextId, "Default service-backed response.")); + } +} diff --git a/src/Waiter.Floor.Bff.Application/Adapters/IWaiterServiceClient.cs b/src/Waiter.Floor.Bff.Application/Adapters/IWaiterServiceClient.cs new file mode 100644 index 0000000..6a5a4fc --- /dev/null +++ b/src/Waiter.Floor.Bff.Application/Adapters/IWaiterServiceClient.cs @@ -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 FetchAsync(GetWaiterAssignmentsRequest request, CancellationToken cancellationToken); +} diff --git a/src/Waiter.Floor.Bff.Application/Handlers/GetWaiterAssignmentsHandler.cs b/src/Waiter.Floor.Bff.Application/Handlers/GetWaiterAssignmentsHandler.cs new file mode 100644 index 0000000..234ba91 --- /dev/null +++ b/src/Waiter.Floor.Bff.Application/Handlers/GetWaiterAssignmentsHandler.cs @@ -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 HandleAsync(GetWaiterAssignmentsRequest request, CancellationToken cancellationToken) + { + return serviceClient.FetchAsync(request, cancellationToken); + } +} diff --git a/src/Waiter.Floor.Bff.Application/Handlers/IGetWaiterAssignmentsHandler.cs b/src/Waiter.Floor.Bff.Application/Handlers/IGetWaiterAssignmentsHandler.cs new file mode 100644 index 0000000..8569ee6 --- /dev/null +++ b/src/Waiter.Floor.Bff.Application/Handlers/IGetWaiterAssignmentsHandler.cs @@ -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 HandleAsync(GetWaiterAssignmentsRequest request, CancellationToken cancellationToken); +} diff --git a/src/Waiter.Floor.Bff.Application/Waiter.Floor.Bff.Application.csproj b/src/Waiter.Floor.Bff.Application/Waiter.Floor.Bff.Application.csproj new file mode 100644 index 0000000..9a37038 --- /dev/null +++ b/src/Waiter.Floor.Bff.Application/Waiter.Floor.Bff.Application.csproj @@ -0,0 +1,12 @@ + + + + net10.0 + enable + enable + + + + + + diff --git a/src/Waiter.Floor.Bff.Contracts/Requests/GetWaiterAssignmentsRequest.cs b/src/Waiter.Floor.Bff.Contracts/Requests/GetWaiterAssignmentsRequest.cs new file mode 100644 index 0000000..23dd30b --- /dev/null +++ b/src/Waiter.Floor.Bff.Contracts/Requests/GetWaiterAssignmentsRequest.cs @@ -0,0 +1,3 @@ +namespace Waiter.Floor.Bff.Contracts.Requests; + +public sealed record GetWaiterAssignmentsRequest(string ContextId); diff --git a/src/Waiter.Floor.Bff.Contracts/Responses/GetWaiterAssignmentsResponse.cs b/src/Waiter.Floor.Bff.Contracts/Responses/GetWaiterAssignmentsResponse.cs new file mode 100644 index 0000000..c241257 --- /dev/null +++ b/src/Waiter.Floor.Bff.Contracts/Responses/GetWaiterAssignmentsResponse.cs @@ -0,0 +1,3 @@ +namespace Waiter.Floor.Bff.Contracts.Responses; + +public sealed record GetWaiterAssignmentsResponse(string ContextId, string Summary); diff --git a/src/Waiter.Floor.Bff.Contracts/Waiter.Floor.Bff.Contracts.csproj b/src/Waiter.Floor.Bff.Contracts/Waiter.Floor.Bff.Contracts.csproj new file mode 100644 index 0000000..b760144 --- /dev/null +++ b/src/Waiter.Floor.Bff.Contracts/Waiter.Floor.Bff.Contracts.csproj @@ -0,0 +1,9 @@ + + + + net10.0 + enable + enable + + + diff --git a/src/Waiter.Floor.Bff.Rest/Program.cs b/src/Waiter.Floor.Bff.Rest/Program.cs new file mode 100644 index 0000000..a84e8ec --- /dev/null +++ b/src/Waiter.Floor.Bff.Rest/Program.cs @@ -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(); +builder.Services.AddSingleton(); + +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(); diff --git a/src/Waiter.Floor.Bff.Rest/Properties/launchSettings.json b/src/Waiter.Floor.Bff.Rest/Properties/launchSettings.json new file mode 100644 index 0000000..c55f6a2 --- /dev/null +++ b/src/Waiter.Floor.Bff.Rest/Properties/launchSettings.json @@ -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" + } + } + } +} diff --git a/src/Waiter.Floor.Bff.Rest/Waiter.Floor.Bff.Rest.csproj b/src/Waiter.Floor.Bff.Rest/Waiter.Floor.Bff.Rest.csproj new file mode 100644 index 0000000..343f9fa --- /dev/null +++ b/src/Waiter.Floor.Bff.Rest/Waiter.Floor.Bff.Rest.csproj @@ -0,0 +1,13 @@ + + + + net10.0 + enable + enable + + + + + + + diff --git a/src/Waiter.Floor.Bff.Rest/appsettings.Development.json b/src/Waiter.Floor.Bff.Rest/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/src/Waiter.Floor.Bff.Rest/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/src/Waiter.Floor.Bff.Rest/appsettings.json b/src/Waiter.Floor.Bff.Rest/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/src/Waiter.Floor.Bff.Rest/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +}