feat(restaurant-admin): add config edge flow

Why: baseline pending admin config edge handlers and runtime assets before security wave.

What: add set service window contracts/handlers, service adapter updates, and docs/docker assets.

Rule: keep technical intent and align repository workflow.
This commit is contained in:
José René White Enciso 2026-03-08 15:00:08 -06:00
parent ff829406ce
commit 5b4c23b6e9
12 changed files with 146 additions and 0 deletions

9
.dockerignore Normal file
View File

@ -0,0 +1,9 @@
**/bin/
**/obj/
.vs/
TestResults/
.git/
.repo-tasks/
.repo-context/
.tasks/
.agile/

22
Dockerfile Normal file
View File

@ -0,0 +1,22 @@
# syntax=docker/dockerfile:1.7
ARG SDK_IMAGE=mcr.microsoft.com/dotnet/sdk:10.0
ARG RUNTIME_IMAGE=mcr.microsoft.com/dotnet/aspnet:10.0
FROM ${SDK_IMAGE} AS build
ARG NUGET_FEED_URL=http://192.168.10.100:3000/api/packages/AgileWebs/nuget/index.json
ARG NUGET_FEED_USERNAME=
ARG NUGET_FEED_TOKEN=
WORKDIR /src
COPY . .
RUN if [ -n "$NUGET_FEED_USERNAME" ] && [ -n "$NUGET_FEED_TOKEN" ]; then dotnet nuget add source "$NUGET_FEED_URL" --name gitea-org --username "$NUGET_FEED_USERNAME" --password "$NUGET_FEED_TOKEN" --store-password-in-clear-text --allow-insecure-connections --configfile /root/.nuget/NuGet/NuGet.Config; fi
RUN dotnet restore "src/Restaurant.Admin.Bff.Rest/Restaurant.Admin.Bff.Rest.csproj" --configfile /root/.nuget/NuGet/NuGet.Config
RUN dotnet publish "src/Restaurant.Admin.Bff.Rest/Restaurant.Admin.Bff.Rest.csproj" -c Release -o /app/publish /p:UseAppHost=false --no-restore
FROM ${RUNTIME_IMAGE} AS runtime
WORKDIR /app
ENV ASPNETCORE_URLS=http://+:8080 ASPNETCORE_ENVIRONMENT=Production
EXPOSE 8080
COPY --from=build /app/publish .
ENTRYPOINT ["dotnet", "Restaurant.Admin.Bff.Rest.dll"]

View File

@ -0,0 +1,6 @@
# Restaurant Admin Ownership Boundary
- Control-plane-facing BFF for policy, schedule, and operational configuration.
- Owns admin edge contracts for feature flags, service windows, and overrides.
- Does not own transactional order execution.
- Consumes service APIs only; no direct DAL access.

View File

@ -0,0 +1,18 @@
# Feature Epics
## Repository
restaurant-admin-bff
## Core Epics
- Epic 1: Expand domain-aligned capabilities for restaurant operations.
- Epic 2: Stabilize service contracts for containerized runtime integration.
- Epic 3: Improve observability and operational readiness for demo compose environments.
## Domain-Specific Candidate Features
- Order lifecycle consistency and state transitions.
- Kitchen queue and dispatch optimization hooks.
- Operations control-plane policies (flags, service windows, overrides).
- POS closeout and settlement summary alignment.
## Documentation Contract
Any code change in this repository must include docs updates in the same branch.

View File

@ -0,0 +1,40 @@
# Containerization Runbook
## Image Build
If the repo consumes internal packages from Gitea, pass feed credentials as build args.
```bash
docker build --build-arg NUGET_FEED_USERNAME=<gitea-login> --build-arg NUGET_FEED_TOKEN=<gitea-token> -t agilewebs/restaurant-admin-bff:dev .
```
## Local Run
```bash
docker run --rm -p 8080:8080 --name restaurant-admin-bff agilewebs/restaurant-admin-bff:dev
```
## Health Probe
- Path: `/health`
- Fallback path: `/healthz`
- Port: `8080`
## Runtime Notes
- Exposes REST control-plane endpoints for admin configuration updates.
## Health Endpoint Consistency
- Canonical probe: `/health`
- Compatibility probe: `/healthz`
- Container port: `8080`
## Demo Integration
- Participates in: **restaurant** demo compose stack.
- Integration artifact path: `greenfield/demo/restaurant/docker-compose.yml`
## Known Limitations
- Current runtime adapters are still predominantly in-memory for deterministic local/demo behavior.
- Demo PostgreSQL seeds validate integration contracts and smoke determinism, but do not yet imply full persistence implementation parity.

View File

@ -9,4 +9,9 @@ public sealed class DefaultRestaurantAdminServiceClient : IRestaurantAdminServic
{
return Task.FromResult(new GetRestaurantAdminConfigResponse(request.ContextId, "Default service-backed response."));
}
public Task<SetServiceWindowResponse> SetServiceWindowAsync(SetServiceWindowRequest request, CancellationToken cancellationToken)
{
return Task.FromResult(new SetServiceWindowResponse(request.ContextId, true, "Service window updated by default adapter."));
}
}

View File

@ -6,4 +6,5 @@ namespace Restaurant.Admin.Bff.Application.Adapters;
public interface IRestaurantAdminServiceClient
{
Task<GetRestaurantAdminConfigResponse> FetchAsync(GetRestaurantAdminConfigRequest request, CancellationToken cancellationToken);
Task<SetServiceWindowResponse> SetServiceWindowAsync(SetServiceWindowRequest request, CancellationToken cancellationToken);
}

View File

@ -0,0 +1,9 @@
using Restaurant.Admin.Bff.Contracts.Requests;
using Restaurant.Admin.Bff.Contracts.Responses;
namespace Restaurant.Admin.Bff.Application.Handlers;
public interface ISetServiceWindowHandler
{
Task<SetServiceWindowResponse> HandleAsync(SetServiceWindowRequest request, CancellationToken cancellationToken);
}

View File

@ -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 SetServiceWindowHandler(IRestaurantAdminServiceClient serviceClient) : ISetServiceWindowHandler
{
public Task<SetServiceWindowResponse> HandleAsync(SetServiceWindowRequest request, CancellationToken cancellationToken)
{
return serviceClient.SetServiceWindowAsync(request, cancellationToken);
}
}

View File

@ -0,0 +1,8 @@
namespace Restaurant.Admin.Bff.Contracts.Requests;
public sealed record SetServiceWindowRequest(
string ContextId,
DayOfWeek Day,
TimeOnly OpenAt,
TimeOnly CloseAt,
string UpdatedBy);

View File

@ -0,0 +1,6 @@
namespace Restaurant.Admin.Bff.Contracts.Responses;
public sealed record SetServiceWindowResponse(
string ContextId,
bool Applied,
string Message);

View File

@ -5,6 +5,7 @@ using Restaurant.Admin.Bff.Contracts.Requests;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddSingleton<IRestaurantAdminServiceClient, DefaultRestaurantAdminServiceClient>();
builder.Services.AddSingleton<IGetRestaurantAdminConfigHandler, GetRestaurantAdminConfigHandler>();
builder.Services.AddSingleton<ISetServiceWindowHandler, SetServiceWindowHandler>();
var app = builder.Build();
@ -14,4 +15,12 @@ app.MapGet("/api/restaurant/admin/config", async (string contextId, IGetRestaura
return Results.Ok(await handler.HandleAsync(request, ct));
});
app.MapPost("/api/restaurant/admin/service-window", async (SetServiceWindowRequest request, ISetServiceWindowHandler handler, CancellationToken ct) =>
{
return Results.Ok(await handler.HandleAsync(request, ct));
});
app.MapGet("/health", () => Results.Ok(new { status = "ok", service = "restaurant-admin-bff" }));
app.MapGet("/healthz", () => Results.Ok(new { status = "ok", service = "restaurant-admin-bff" }));
app.Run();