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..04d922a --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,10 @@ + + + AgileWebs + AgileWebs + git + http://192.168.68.156:3000/AgileWebs/kitchen-ops-bff + http://192.168.68.156:3000/AgileWebs/kitchen-ops-bff + false + + diff --git a/Kitchen.Ops.Bff.slnx b/Kitchen.Ops.Bff.slnx new file mode 100644 index 0000000..98a2632 --- /dev/null +++ b/Kitchen.Ops.Bff.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/Kitchen.Ops.Bff.Application/Adapters/DefaultKitchenServiceClient.cs b/src/Kitchen.Ops.Bff.Application/Adapters/DefaultKitchenServiceClient.cs new file mode 100644 index 0000000..65b0e6a --- /dev/null +++ b/src/Kitchen.Ops.Bff.Application/Adapters/DefaultKitchenServiceClient.cs @@ -0,0 +1,12 @@ +using Kitchen.Ops.Bff.Contracts.Requests; +using Kitchen.Ops.Bff.Contracts.Responses; + +namespace Kitchen.Ops.Bff.Application.Adapters; + +public sealed class DefaultKitchenServiceClient : IKitchenServiceClient +{ + public Task FetchAsync(GetKitchenOpsBoardRequest request, CancellationToken cancellationToken) + { + return Task.FromResult(new GetKitchenOpsBoardResponse(request.ContextId, "Default service-backed response.")); + } +} diff --git a/src/Kitchen.Ops.Bff.Application/Adapters/IKitchenServiceClient.cs b/src/Kitchen.Ops.Bff.Application/Adapters/IKitchenServiceClient.cs new file mode 100644 index 0000000..4198728 --- /dev/null +++ b/src/Kitchen.Ops.Bff.Application/Adapters/IKitchenServiceClient.cs @@ -0,0 +1,9 @@ +using Kitchen.Ops.Bff.Contracts.Requests; +using Kitchen.Ops.Bff.Contracts.Responses; + +namespace Kitchen.Ops.Bff.Application.Adapters; + +public interface IKitchenServiceClient +{ + Task FetchAsync(GetKitchenOpsBoardRequest request, CancellationToken cancellationToken); +} diff --git a/src/Kitchen.Ops.Bff.Application/Handlers/GetKitchenOpsBoardHandler.cs b/src/Kitchen.Ops.Bff.Application/Handlers/GetKitchenOpsBoardHandler.cs new file mode 100644 index 0000000..d52f841 --- /dev/null +++ b/src/Kitchen.Ops.Bff.Application/Handlers/GetKitchenOpsBoardHandler.cs @@ -0,0 +1,13 @@ +using Kitchen.Ops.Bff.Application.Adapters; +using Kitchen.Ops.Bff.Contracts.Requests; +using Kitchen.Ops.Bff.Contracts.Responses; + +namespace Kitchen.Ops.Bff.Application.Handlers; + +public sealed class GetKitchenOpsBoardHandler(IKitchenServiceClient serviceClient) : IGetKitchenOpsBoardHandler +{ + public Task HandleAsync(GetKitchenOpsBoardRequest request, CancellationToken cancellationToken) + { + return serviceClient.FetchAsync(request, cancellationToken); + } +} diff --git a/src/Kitchen.Ops.Bff.Application/Handlers/IGetKitchenOpsBoardHandler.cs b/src/Kitchen.Ops.Bff.Application/Handlers/IGetKitchenOpsBoardHandler.cs new file mode 100644 index 0000000..a5961be --- /dev/null +++ b/src/Kitchen.Ops.Bff.Application/Handlers/IGetKitchenOpsBoardHandler.cs @@ -0,0 +1,9 @@ +using Kitchen.Ops.Bff.Contracts.Requests; +using Kitchen.Ops.Bff.Contracts.Responses; + +namespace Kitchen.Ops.Bff.Application.Handlers; + +public interface IGetKitchenOpsBoardHandler +{ + Task HandleAsync(GetKitchenOpsBoardRequest request, CancellationToken cancellationToken); +} diff --git a/src/Kitchen.Ops.Bff.Application/Kitchen.Ops.Bff.Application.csproj b/src/Kitchen.Ops.Bff.Application/Kitchen.Ops.Bff.Application.csproj new file mode 100644 index 0000000..3f86c11 --- /dev/null +++ b/src/Kitchen.Ops.Bff.Application/Kitchen.Ops.Bff.Application.csproj @@ -0,0 +1,12 @@ + + + + net10.0 + enable + enable + + + + + + diff --git a/src/Kitchen.Ops.Bff.Contracts/Kitchen.Ops.Bff.Contracts.csproj b/src/Kitchen.Ops.Bff.Contracts/Kitchen.Ops.Bff.Contracts.csproj new file mode 100644 index 0000000..b760144 --- /dev/null +++ b/src/Kitchen.Ops.Bff.Contracts/Kitchen.Ops.Bff.Contracts.csproj @@ -0,0 +1,9 @@ + + + + net10.0 + enable + enable + + + diff --git a/src/Kitchen.Ops.Bff.Contracts/Requests/GetKitchenOpsBoardRequest.cs b/src/Kitchen.Ops.Bff.Contracts/Requests/GetKitchenOpsBoardRequest.cs new file mode 100644 index 0000000..503fdff --- /dev/null +++ b/src/Kitchen.Ops.Bff.Contracts/Requests/GetKitchenOpsBoardRequest.cs @@ -0,0 +1,3 @@ +namespace Kitchen.Ops.Bff.Contracts.Requests; + +public sealed record GetKitchenOpsBoardRequest(string ContextId); diff --git a/src/Kitchen.Ops.Bff.Contracts/Responses/GetKitchenOpsBoardResponse.cs b/src/Kitchen.Ops.Bff.Contracts/Responses/GetKitchenOpsBoardResponse.cs new file mode 100644 index 0000000..5be7904 --- /dev/null +++ b/src/Kitchen.Ops.Bff.Contracts/Responses/GetKitchenOpsBoardResponse.cs @@ -0,0 +1,3 @@ +namespace Kitchen.Ops.Bff.Contracts.Responses; + +public sealed record GetKitchenOpsBoardResponse(string ContextId, string Summary); diff --git a/src/Kitchen.Ops.Bff.Rest/Kitchen.Ops.Bff.Rest.csproj b/src/Kitchen.Ops.Bff.Rest/Kitchen.Ops.Bff.Rest.csproj new file mode 100644 index 0000000..5d6cc6f --- /dev/null +++ b/src/Kitchen.Ops.Bff.Rest/Kitchen.Ops.Bff.Rest.csproj @@ -0,0 +1,13 @@ + + + + net10.0 + enable + enable + + + + + + + diff --git a/src/Kitchen.Ops.Bff.Rest/Program.cs b/src/Kitchen.Ops.Bff.Rest/Program.cs new file mode 100644 index 0000000..6503dc7 --- /dev/null +++ b/src/Kitchen.Ops.Bff.Rest/Program.cs @@ -0,0 +1,17 @@ +using Kitchen.Ops.Bff.Application.Adapters; +using Kitchen.Ops.Bff.Application.Handlers; +using Kitchen.Ops.Bff.Contracts.Requests; + +var builder = WebApplication.CreateBuilder(args); +builder.Services.AddSingleton(); +builder.Services.AddSingleton(); + +var app = builder.Build(); + +app.MapGet("/api/kitchen/ops/board", async (string contextId, IGetKitchenOpsBoardHandler handler, CancellationToken ct) => +{ + var request = new GetKitchenOpsBoardRequest(contextId); + return Results.Ok(await handler.HandleAsync(request, ct)); +}); + +app.Run(); diff --git a/src/Kitchen.Ops.Bff.Rest/Properties/launchSettings.json b/src/Kitchen.Ops.Bff.Rest/Properties/launchSettings.json new file mode 100644 index 0000000..c55f6a2 --- /dev/null +++ b/src/Kitchen.Ops.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/Kitchen.Ops.Bff.Rest/appsettings.Development.json b/src/Kitchen.Ops.Bff.Rest/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/src/Kitchen.Ops.Bff.Rest/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/src/Kitchen.Ops.Bff.Rest/appsettings.json b/src/Kitchen.Ops.Bff.Rest/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/src/Kitchen.Ops.Bff.Rest/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +}