From 5c887dee87f03edc8b790b12860eaf53f7278e9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Ren=C3=A9=20White=20Enciso?= Date: Sun, 8 Mar 2026 15:00:08 -0600 Subject: [PATCH] feat(waiter-floor): add order edge flow Why: baseline pending order edge handlers and runtime assets before security wave. What: add submit order contracts/handlers, service adapter updates, and docs/docker assets. Rule: keep technical intent and align repository workflow. --- .dockerignore | 9 +++++ Dockerfile | 22 ++++++++++ docs/architecture/ownership-boundary.md | 6 +++ docs/roadmap/feature-epics.md | 18 +++++++++ docs/runbooks/containerization.md | 40 +++++++++++++++++++ .../Adapters/DefaultWaiterServiceClient.cs | 5 +++ .../Adapters/IWaiterServiceClient.cs | 1 + .../Handlers/ISubmitFloorOrderHandler.cs | 9 +++++ .../Handlers/SubmitFloorOrderHandler.cs | 13 ++++++ .../Requests/SubmitFloorOrderRequest.cs | 7 ++++ .../Responses/SubmitFloorOrderResponse.cs | 6 +++ src/Waiter.Floor.Bff.Rest/Program.cs | 9 +++++ 12 files changed, 145 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docs/architecture/ownership-boundary.md create mode 100644 docs/roadmap/feature-epics.md create mode 100644 docs/runbooks/containerization.md create mode 100644 src/Waiter.Floor.Bff.Application/Handlers/ISubmitFloorOrderHandler.cs create mode 100644 src/Waiter.Floor.Bff.Application/Handlers/SubmitFloorOrderHandler.cs create mode 100644 src/Waiter.Floor.Bff.Contracts/Requests/SubmitFloorOrderRequest.cs create mode 100644 src/Waiter.Floor.Bff.Contracts/Responses/SubmitFloorOrderResponse.cs diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..636f769 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +**/bin/ +**/obj/ +.vs/ +TestResults/ +.git/ +.repo-tasks/ +.repo-context/ +.tasks/ +.agile/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..063e7c3 --- /dev/null +++ b/Dockerfile @@ -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/Waiter.Floor.Bff.Rest/Waiter.Floor.Bff.Rest.csproj" --configfile /root/.nuget/NuGet/NuGet.Config +RUN dotnet publish "src/Waiter.Floor.Bff.Rest/Waiter.Floor.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", "Waiter.Floor.Bff.Rest.dll"] diff --git a/docs/architecture/ownership-boundary.md b/docs/architecture/ownership-boundary.md new file mode 100644 index 0000000..c092119 --- /dev/null +++ b/docs/architecture/ownership-boundary.md @@ -0,0 +1,6 @@ +# Waiter Floor Ownership Boundary + +- Execution-facing BFF for floor staff workflows. +- Owns edge contracts for assignment views and order-taking orchestration. +- Does not own policy/config control-plane concerns. +- Consumes service APIs only; no direct DAL access. diff --git a/docs/roadmap/feature-epics.md b/docs/roadmap/feature-epics.md new file mode 100644 index 0000000..c23fd74 --- /dev/null +++ b/docs/roadmap/feature-epics.md @@ -0,0 +1,18 @@ +# Feature Epics + +## Repository +waiter-floor-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. diff --git a/docs/runbooks/containerization.md b/docs/runbooks/containerization.md new file mode 100644 index 0000000..20b9c44 --- /dev/null +++ b/docs/runbooks/containerization.md @@ -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= --build-arg NUGET_FEED_TOKEN= -t agilewebs/waiter-floor-bff:dev . +``` + +## Local Run + +```bash +docker run --rm -p 8080:8080 --name waiter-floor-bff agilewebs/waiter-floor-bff:dev +``` + +## Health Probe + +- Path: `/health` +- Fallback path: `/healthz` +- Port: `8080` + +## Runtime Notes + +- Exposes REST edge endpoints for waiter assignment and order submission flows. + +## 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. diff --git a/src/Waiter.Floor.Bff.Application/Adapters/DefaultWaiterServiceClient.cs b/src/Waiter.Floor.Bff.Application/Adapters/DefaultWaiterServiceClient.cs index a722122..82789b2 100644 --- a/src/Waiter.Floor.Bff.Application/Adapters/DefaultWaiterServiceClient.cs +++ b/src/Waiter.Floor.Bff.Application/Adapters/DefaultWaiterServiceClient.cs @@ -9,4 +9,9 @@ public sealed class DefaultWaiterServiceClient : IWaiterServiceClient { return Task.FromResult(new GetWaiterAssignmentsResponse(request.ContextId, "Default service-backed response.")); } + + public Task SubmitOrderAsync(SubmitFloorOrderRequest request, CancellationToken cancellationToken) + { + return Task.FromResult(new SubmitFloorOrderResponse(request.OrderId, true, "Order accepted by waiter-floor default adapter.")); + } } diff --git a/src/Waiter.Floor.Bff.Application/Adapters/IWaiterServiceClient.cs b/src/Waiter.Floor.Bff.Application/Adapters/IWaiterServiceClient.cs index 6a5a4fc..c768397 100644 --- a/src/Waiter.Floor.Bff.Application/Adapters/IWaiterServiceClient.cs +++ b/src/Waiter.Floor.Bff.Application/Adapters/IWaiterServiceClient.cs @@ -6,4 +6,5 @@ namespace Waiter.Floor.Bff.Application.Adapters; public interface IWaiterServiceClient { Task FetchAsync(GetWaiterAssignmentsRequest request, CancellationToken cancellationToken); + Task SubmitOrderAsync(SubmitFloorOrderRequest request, CancellationToken cancellationToken); } diff --git a/src/Waiter.Floor.Bff.Application/Handlers/ISubmitFloorOrderHandler.cs b/src/Waiter.Floor.Bff.Application/Handlers/ISubmitFloorOrderHandler.cs new file mode 100644 index 0000000..7d56d0e --- /dev/null +++ b/src/Waiter.Floor.Bff.Application/Handlers/ISubmitFloorOrderHandler.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 ISubmitFloorOrderHandler +{ + Task HandleAsync(SubmitFloorOrderRequest request, CancellationToken cancellationToken); +} diff --git a/src/Waiter.Floor.Bff.Application/Handlers/SubmitFloorOrderHandler.cs b/src/Waiter.Floor.Bff.Application/Handlers/SubmitFloorOrderHandler.cs new file mode 100644 index 0000000..ffbafc1 --- /dev/null +++ b/src/Waiter.Floor.Bff.Application/Handlers/SubmitFloorOrderHandler.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 SubmitFloorOrderHandler(IWaiterServiceClient serviceClient) : ISubmitFloorOrderHandler +{ + public Task HandleAsync(SubmitFloorOrderRequest request, CancellationToken cancellationToken) + { + return serviceClient.SubmitOrderAsync(request, cancellationToken); + } +} diff --git a/src/Waiter.Floor.Bff.Contracts/Requests/SubmitFloorOrderRequest.cs b/src/Waiter.Floor.Bff.Contracts/Requests/SubmitFloorOrderRequest.cs new file mode 100644 index 0000000..161e870 --- /dev/null +++ b/src/Waiter.Floor.Bff.Contracts/Requests/SubmitFloorOrderRequest.cs @@ -0,0 +1,7 @@ +namespace Waiter.Floor.Bff.Contracts.Requests; + +public sealed record SubmitFloorOrderRequest( + string ContextId, + string TableId, + string OrderId, + int ItemCount); diff --git a/src/Waiter.Floor.Bff.Contracts/Responses/SubmitFloorOrderResponse.cs b/src/Waiter.Floor.Bff.Contracts/Responses/SubmitFloorOrderResponse.cs new file mode 100644 index 0000000..fc3c9e2 --- /dev/null +++ b/src/Waiter.Floor.Bff.Contracts/Responses/SubmitFloorOrderResponse.cs @@ -0,0 +1,6 @@ +namespace Waiter.Floor.Bff.Contracts.Responses; + +public sealed record SubmitFloorOrderResponse( + string OrderId, + bool Accepted, + string Message); diff --git a/src/Waiter.Floor.Bff.Rest/Program.cs b/src/Waiter.Floor.Bff.Rest/Program.cs index a84e8ec..9a76fb3 100644 --- a/src/Waiter.Floor.Bff.Rest/Program.cs +++ b/src/Waiter.Floor.Bff.Rest/Program.cs @@ -5,6 +5,7 @@ using Waiter.Floor.Bff.Contracts.Requests; var builder = WebApplication.CreateBuilder(args); builder.Services.AddSingleton(); builder.Services.AddSingleton(); +builder.Services.AddSingleton(); var app = builder.Build(); @@ -14,4 +15,12 @@ app.MapGet("/api/waiter/floor/assignments", async (string contextId, IGetWaiterA return Results.Ok(await handler.HandleAsync(request, ct)); }); +app.MapPost("/api/waiter/floor/orders", async (SubmitFloorOrderRequest request, ISubmitFloorOrderHandler handler, CancellationToken ct) => +{ + return Results.Ok(await handler.HandleAsync(request, ct)); +}); + +app.MapGet("/health", () => Results.Ok(new { status = "ok", service = "waiter-floor-bff" })); +app.MapGet("/healthz", () => Results.Ok(new { status = "ok", service = "waiter-floor-bff" })); + app.Run();