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..cbce52b --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,10 @@ + + + AgileWebs + AgileWebs + git + http://192.168.68.156:3000/AgileWebs/restaurant-admin-bff + http://192.168.68.156:3000/AgileWebs/restaurant-admin-bff + false + + diff --git a/Restaurant.Admin.Bff.slnx b/Restaurant.Admin.Bff.slnx new file mode 100644 index 0000000..0044d68 --- /dev/null +++ b/Restaurant.Admin.Bff.slnx @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/Restaurant.Admin.Bff.Application/Adapters/DefaultRestaurantAdminServiceClient.cs b/src/Restaurant.Admin.Bff.Application/Adapters/DefaultRestaurantAdminServiceClient.cs new file mode 100644 index 0000000..1d305b9 --- /dev/null +++ b/src/Restaurant.Admin.Bff.Application/Adapters/DefaultRestaurantAdminServiceClient.cs @@ -0,0 +1,12 @@ +using Restaurant.Admin.Bff.Contracts.Requests; +using Restaurant.Admin.Bff.Contracts.Responses; + +namespace Restaurant.Admin.Bff.Application.Adapters; + +public sealed class DefaultRestaurantAdminServiceClient : IRestaurantAdminServiceClient +{ + public Task FetchAsync(GetRestaurantAdminConfigRequest request, CancellationToken cancellationToken) + { + return Task.FromResult(new GetRestaurantAdminConfigResponse(request.ContextId, "Default service-backed response.")); + } +} diff --git a/src/Restaurant.Admin.Bff.Application/Adapters/IRestaurantAdminServiceClient.cs b/src/Restaurant.Admin.Bff.Application/Adapters/IRestaurantAdminServiceClient.cs new file mode 100644 index 0000000..a25c3d1 --- /dev/null +++ b/src/Restaurant.Admin.Bff.Application/Adapters/IRestaurantAdminServiceClient.cs @@ -0,0 +1,9 @@ +using Restaurant.Admin.Bff.Contracts.Requests; +using Restaurant.Admin.Bff.Contracts.Responses; + +namespace Restaurant.Admin.Bff.Application.Adapters; + +public interface IRestaurantAdminServiceClient +{ + Task FetchAsync(GetRestaurantAdminConfigRequest request, CancellationToken cancellationToken); +} diff --git a/src/Restaurant.Admin.Bff.Application/Handlers/GetRestaurantAdminConfigHandler.cs b/src/Restaurant.Admin.Bff.Application/Handlers/GetRestaurantAdminConfigHandler.cs new file mode 100644 index 0000000..2daffd8 --- /dev/null +++ b/src/Restaurant.Admin.Bff.Application/Handlers/GetRestaurantAdminConfigHandler.cs @@ -0,0 +1,13 @@ +using Restaurant.Admin.Bff.Application.Adapters; +using Restaurant.Admin.Bff.Contracts.Requests; +using Restaurant.Admin.Bff.Contracts.Responses; + +namespace Restaurant.Admin.Bff.Application.Handlers; + +public sealed class GetRestaurantAdminConfigHandler(IRestaurantAdminServiceClient serviceClient) : IGetRestaurantAdminConfigHandler +{ + public Task HandleAsync(GetRestaurantAdminConfigRequest request, CancellationToken cancellationToken) + { + return serviceClient.FetchAsync(request, cancellationToken); + } +} diff --git a/src/Restaurant.Admin.Bff.Application/Handlers/IGetRestaurantAdminConfigHandler.cs b/src/Restaurant.Admin.Bff.Application/Handlers/IGetRestaurantAdminConfigHandler.cs new file mode 100644 index 0000000..d3cee44 --- /dev/null +++ b/src/Restaurant.Admin.Bff.Application/Handlers/IGetRestaurantAdminConfigHandler.cs @@ -0,0 +1,9 @@ +using Restaurant.Admin.Bff.Contracts.Requests; +using Restaurant.Admin.Bff.Contracts.Responses; + +namespace Restaurant.Admin.Bff.Application.Handlers; + +public interface IGetRestaurantAdminConfigHandler +{ + Task HandleAsync(GetRestaurantAdminConfigRequest request, CancellationToken cancellationToken); +} diff --git a/src/Restaurant.Admin.Bff.Application/Restaurant.Admin.Bff.Application.csproj b/src/Restaurant.Admin.Bff.Application/Restaurant.Admin.Bff.Application.csproj new file mode 100644 index 0000000..b1c3b04 --- /dev/null +++ b/src/Restaurant.Admin.Bff.Application/Restaurant.Admin.Bff.Application.csproj @@ -0,0 +1,12 @@ + + + + net10.0 + enable + enable + + + + + + diff --git a/src/Restaurant.Admin.Bff.Contracts/Requests/GetRestaurantAdminConfigRequest.cs b/src/Restaurant.Admin.Bff.Contracts/Requests/GetRestaurantAdminConfigRequest.cs new file mode 100644 index 0000000..24152e8 --- /dev/null +++ b/src/Restaurant.Admin.Bff.Contracts/Requests/GetRestaurantAdminConfigRequest.cs @@ -0,0 +1,3 @@ +namespace Restaurant.Admin.Bff.Contracts.Requests; + +public sealed record GetRestaurantAdminConfigRequest(string ContextId); diff --git a/src/Restaurant.Admin.Bff.Contracts/Responses/GetRestaurantAdminConfigResponse.cs b/src/Restaurant.Admin.Bff.Contracts/Responses/GetRestaurantAdminConfigResponse.cs new file mode 100644 index 0000000..1e1cfdd --- /dev/null +++ b/src/Restaurant.Admin.Bff.Contracts/Responses/GetRestaurantAdminConfigResponse.cs @@ -0,0 +1,3 @@ +namespace Restaurant.Admin.Bff.Contracts.Responses; + +public sealed record GetRestaurantAdminConfigResponse(string ContextId, string Summary); diff --git a/src/Restaurant.Admin.Bff.Contracts/Restaurant.Admin.Bff.Contracts.csproj b/src/Restaurant.Admin.Bff.Contracts/Restaurant.Admin.Bff.Contracts.csproj new file mode 100644 index 0000000..b760144 --- /dev/null +++ b/src/Restaurant.Admin.Bff.Contracts/Restaurant.Admin.Bff.Contracts.csproj @@ -0,0 +1,9 @@ + + + + net10.0 + enable + enable + + + diff --git a/src/Restaurant.Admin.Bff.Rest/Program.cs b/src/Restaurant.Admin.Bff.Rest/Program.cs new file mode 100644 index 0000000..62d3987 --- /dev/null +++ b/src/Restaurant.Admin.Bff.Rest/Program.cs @@ -0,0 +1,17 @@ +using Restaurant.Admin.Bff.Application.Adapters; +using Restaurant.Admin.Bff.Application.Handlers; +using Restaurant.Admin.Bff.Contracts.Requests; + +var builder = WebApplication.CreateBuilder(args); +builder.Services.AddSingleton(); +builder.Services.AddSingleton(); + +var app = builder.Build(); + +app.MapGet("/api/restaurant/admin/config", async (string contextId, IGetRestaurantAdminConfigHandler handler, CancellationToken ct) => +{ + var request = new GetRestaurantAdminConfigRequest(contextId); + return Results.Ok(await handler.HandleAsync(request, ct)); +}); + +app.Run(); diff --git a/src/Restaurant.Admin.Bff.Rest/Properties/launchSettings.json b/src/Restaurant.Admin.Bff.Rest/Properties/launchSettings.json new file mode 100644 index 0000000..c55f6a2 --- /dev/null +++ b/src/Restaurant.Admin.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/Restaurant.Admin.Bff.Rest/Restaurant.Admin.Bff.Rest.csproj b/src/Restaurant.Admin.Bff.Rest/Restaurant.Admin.Bff.Rest.csproj new file mode 100644 index 0000000..80fe00b --- /dev/null +++ b/src/Restaurant.Admin.Bff.Rest/Restaurant.Admin.Bff.Rest.csproj @@ -0,0 +1,13 @@ + + + + net10.0 + enable + enable + + + + + + + diff --git a/src/Restaurant.Admin.Bff.Rest/appsettings.Development.json b/src/Restaurant.Admin.Bff.Rest/appsettings.Development.json new file mode 100644 index 0000000..0c208ae --- /dev/null +++ b/src/Restaurant.Admin.Bff.Rest/appsettings.Development.json @@ -0,0 +1,8 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + } +} diff --git a/src/Restaurant.Admin.Bff.Rest/appsettings.json b/src/Restaurant.Admin.Bff.Rest/appsettings.json new file mode 100644 index 0000000..10f68b8 --- /dev/null +++ b/src/Restaurant.Admin.Bff.Rest/appsettings.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*" +}