chore(furniture-service): checkpoint pending development updates
This commit is contained in:
parent
53055650df
commit
bff24f3124
9
.dockerignore
Normal file
9
.dockerignore
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
**/bin/
|
||||||
|
**/obj/
|
||||||
|
.vs/
|
||||||
|
TestResults/
|
||||||
|
.git/
|
||||||
|
.repo-tasks/
|
||||||
|
.repo-context/
|
||||||
|
.tasks/
|
||||||
|
.agile/
|
||||||
@ -3,8 +3,8 @@
|
|||||||
<Authors>AgileWebs</Authors>
|
<Authors>AgileWebs</Authors>
|
||||||
<Company>AgileWebs</Company>
|
<Company>AgileWebs</Company>
|
||||||
<RepositoryType>git</RepositoryType>
|
<RepositoryType>git</RepositoryType>
|
||||||
<RepositoryUrl>http://192.168.10.100:3000/AgileWebs/furniture-service</RepositoryUrl>
|
<RepositoryUrl>https://gitea.dream-views.com/AgileWebs/furniture-service</RepositoryUrl>
|
||||||
<PackageProjectUrl>http://192.168.10.100:3000/AgileWebs/furniture-service</PackageProjectUrl>
|
<PackageProjectUrl>https://gitea.dream-views.com/AgileWebs/furniture-service</PackageProjectUrl>
|
||||||
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
23
Dockerfile
Normal file
23
Dockerfile
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# 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=https://gitea.dream-views.com/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/Furniture.Service.Grpc/Furniture.Service.Grpc.csproj" --configfile /root/.nuget/NuGet/NuGet.Config
|
||||||
|
RUN dotnet publish "src/Furniture.Service.Grpc/Furniture.Service.Grpc.csproj" -c Release -o /app/publish /p:UseAppHost=false --no-restore
|
||||||
|
|
||||||
|
FROM ${RUNTIME_IMAGE} AS runtime
|
||||||
|
WORKDIR /app
|
||||||
|
ENV ASPNETCORE_ENVIRONMENT=Production
|
||||||
|
EXPOSE 8080
|
||||||
|
EXPOSE 8081
|
||||||
|
COPY --from=build /app/publish .
|
||||||
|
ENTRYPOINT ["dotnet", "Furniture.Service.Grpc.dll"]
|
||||||
@ -6,6 +6,7 @@
|
|||||||
- Use cases depend on DAL-facing ports, not persistence implementations.
|
- Use cases depend on DAL-facing ports, not persistence implementations.
|
||||||
- Use cases consume BuildingBlock capability contracts through adapter and port boundaries.
|
- Use cases consume BuildingBlock capability contracts through adapter and port boundaries.
|
||||||
- Transport handlers map to use-case contracts and do not own orchestration logic.
|
- Transport handlers map to use-case contracts and do not own orchestration logic.
|
||||||
|
- Demo/runtime aliases (`demo-context`, `FURN-*`, `PROD-FURN-*`) are normalized at use-case orchestration before port calls.
|
||||||
|
|
||||||
## Current Skeleton
|
## Current Skeleton
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
## Feed
|
## Feed
|
||||||
|
|
||||||
- Source: `http://192.168.10.100:3000/api/packages/AgileWebs/nuget/index.json`
|
- Source: `https://gitea.dream-views.com/api/packages/AgileWebs/nuget/index.json`
|
||||||
- Authentication: Gitea login + token
|
- Authentication: Gitea login + token
|
||||||
- HTTP requirement: `allowInsecureConnections="true"` in `nuget.config`
|
- HTTP requirement: `allowInsecureConnections="true"` in `nuget.config`
|
||||||
|
|
||||||
|
|||||||
18
docs/roadmap/feature-epics.md
Normal file
18
docs/roadmap/feature-epics.md
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
# Feature Epics
|
||||||
|
|
||||||
|
## Repository
|
||||||
|
furniture-service
|
||||||
|
|
||||||
|
## 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.
|
||||||
40
docs/runbooks/containerization.md
Normal file
40
docs/runbooks/containerization.md
Normal 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/furniture-service:dev .
|
||||||
|
```
|
||||||
|
|
||||||
|
## Local Run
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run --rm -p 8080:8080 --name furniture-service agilewebs/furniture-service:dev
|
||||||
|
```
|
||||||
|
|
||||||
|
## Health Probe
|
||||||
|
|
||||||
|
- Path: `/health`
|
||||||
|
- Fallback path: `/healthz`
|
||||||
|
- Port: `8080`
|
||||||
|
|
||||||
|
## Runtime Notes
|
||||||
|
|
||||||
|
- Exposes internal service endpoint set plus gRPC runtime surface.
|
||||||
|
|
||||||
|
## Health Endpoint Consistency
|
||||||
|
|
||||||
|
- Canonical probe: `/health`
|
||||||
|
- Compatibility probe: `/healthz`
|
||||||
|
- Container port: `8080`
|
||||||
|
|
||||||
|
## Demo Integration
|
||||||
|
|
||||||
|
- Participates in: **furniture** demo compose stack.
|
||||||
|
- Integration artifact path: `greenfield/demo/furniture/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.
|
||||||
@ -14,14 +14,38 @@ public sealed class GetFurnitureAvailabilityUseCase(
|
|||||||
IFurnitureAvailabilityReadPort inventoryReadPort)
|
IFurnitureAvailabilityReadPort inventoryReadPort)
|
||||||
: IGetFurnitureAvailabilityUseCase
|
: IGetFurnitureAvailabilityUseCase
|
||||||
{
|
{
|
||||||
|
private static readonly IReadOnlyDictionary<string, (string InventoryItemCode, string CatalogProductId)> LookupAliases =
|
||||||
|
new Dictionary<string, (string InventoryItemCode, string CatalogProductId)>(StringComparer.OrdinalIgnoreCase)
|
||||||
|
{
|
||||||
|
["demo-context"] = ("FUR-001", "PRD-001"),
|
||||||
|
["FURN-001"] = ("FUR-001", "PRD-001"),
|
||||||
|
["FURN-002"] = ("FUR-002", "PRD-002"),
|
||||||
|
["FURN-003"] = ("FUR-003", "PRD-003"),
|
||||||
|
["PROD-FURN-001"] = ("FUR-001", "PRD-001"),
|
||||||
|
["PROD-FURN-002"] = ("FUR-002", "PRD-002"),
|
||||||
|
["PROD-FURN-003"] = ("FUR-003", "PRD-003"),
|
||||||
|
["FUR-001"] = ("FUR-001", "PRD-001"),
|
||||||
|
["FUR-002"] = ("FUR-002", "PRD-002"),
|
||||||
|
["FUR-003"] = ("FUR-003", "PRD-003"),
|
||||||
|
["PRD-001"] = ("FUR-001", "PRD-001"),
|
||||||
|
["PRD-002"] = ("FUR-002", "PRD-002"),
|
||||||
|
["PRD-003"] = ("FUR-003", "PRD-003")
|
||||||
|
};
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public async Task<GetFurnitureAvailabilityResponse> HandleAsync(GetFurnitureAvailabilityRequest request)
|
public async Task<GetFurnitureAvailabilityResponse> HandleAsync(GetFurnitureAvailabilityRequest request)
|
||||||
{
|
{
|
||||||
var domainRequest = new FurnitureAvailabilityDecisionRequest(
|
var domainRequest = new FurnitureAvailabilityDecisionRequest(
|
||||||
request.FurnitureId,
|
request.FurnitureId,
|
||||||
request.CorrelationId);
|
request.CorrelationId);
|
||||||
var catalogRequest = decisionService.BuildCatalogRequest(domainRequest);
|
var lookupKeys = ResolveLookupKeys(request.FurnitureId);
|
||||||
var inventoryRequest = decisionService.BuildInventoryRequest(domainRequest);
|
|
||||||
|
var catalogRequest = decisionService
|
||||||
|
.BuildCatalogRequest(domainRequest)
|
||||||
|
with { ProductId = lookupKeys.CatalogProductId };
|
||||||
|
var inventoryRequest = decisionService
|
||||||
|
.BuildInventoryRequest(domainRequest)
|
||||||
|
with { ItemCode = lookupKeys.InventoryItemCode };
|
||||||
|
|
||||||
var catalogTask = catalogReadPort.ReadProductAsync(catalogRequest);
|
var catalogTask = catalogReadPort.ReadProductAsync(catalogRequest);
|
||||||
var inventoryTask = inventoryReadPort.ReadAvailabilityAsync(inventoryRequest);
|
var inventoryTask = inventoryReadPort.ReadAvailabilityAsync(inventoryRequest);
|
||||||
@ -38,4 +62,14 @@ public sealed class GetFurnitureAvailabilityUseCase(
|
|||||||
domainResponse.DisplayName,
|
domainResponse.DisplayName,
|
||||||
domainResponse.QuantityAvailable);
|
domainResponse.QuantityAvailable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static (string InventoryItemCode, string CatalogProductId) ResolveLookupKeys(string furnitureId)
|
||||||
|
{
|
||||||
|
if (LookupAliases.TryGetValue(furnitureId, out var mappedKeys))
|
||||||
|
{
|
||||||
|
return mappedKeys;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (furnitureId, furnitureId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,16 @@
|
|||||||
using Furniture.Service.Application.DependencyInjection;
|
using Furniture.Service.Application.DependencyInjection;
|
||||||
using Furniture.Service.Grpc.Services;
|
using Furniture.Service.Grpc.Services;
|
||||||
|
using Microsoft.AspNetCore.Server.Kestrel.Core;
|
||||||
|
|
||||||
var builder = WebApplication.CreateBuilder(args);
|
var builder = WebApplication.CreateBuilder(args);
|
||||||
|
var httpPort = builder.Configuration.GetValue("FurnitureService:HttpPort", 8080);
|
||||||
|
var grpcPort = builder.Configuration.GetValue("FurnitureService:GrpcPort", 8081);
|
||||||
|
|
||||||
|
builder.WebHost.ConfigureKestrel(options =>
|
||||||
|
{
|
||||||
|
options.ListenAnyIP(httpPort, listenOptions => listenOptions.Protocols = HttpProtocols.Http1);
|
||||||
|
options.ListenAnyIP(grpcPort, listenOptions => listenOptions.Protocols = HttpProtocols.Http2);
|
||||||
|
});
|
||||||
|
|
||||||
builder.Services.AddGrpc();
|
builder.Services.AddGrpc();
|
||||||
builder.Services.AddHealthChecks();
|
builder.Services.AddHealthChecks();
|
||||||
@ -11,5 +20,6 @@ var app = builder.Build();
|
|||||||
|
|
||||||
app.MapGrpcService<FurnitureRuntimeGrpcService>();
|
app.MapGrpcService<FurnitureRuntimeGrpcService>();
|
||||||
app.MapHealthChecks("/healthz");
|
app.MapHealthChecks("/healthz");
|
||||||
|
app.MapHealthChecks("/health");
|
||||||
|
|
||||||
app.Run();
|
app.Run();
|
||||||
|
|||||||
@ -21,6 +21,23 @@ public class RuntimeWiringTests
|
|||||||
var response = await useCase.HandleAsync(new GetFurnitureAvailabilityRequest("FUR-001", "corr-123"));
|
var response = await useCase.HandleAsync(new GetFurnitureAvailabilityRequest("FUR-001", "corr-123"));
|
||||||
|
|
||||||
Assert.Equal("FUR-001", response.FurnitureId);
|
Assert.Equal("FUR-001", response.FurnitureId);
|
||||||
|
Assert.Equal("Contoso Lounge Chair", response.DisplayName);
|
||||||
|
Assert.Equal(8, response.QuantityAvailable);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public async Task AddFurnitureServiceRuntime_WhenUsingDemoFurnitureAlias_ResolvesMappedAvailability()
|
||||||
|
{
|
||||||
|
var services = new ServiceCollection();
|
||||||
|
services.AddFurnitureServiceRuntime();
|
||||||
|
|
||||||
|
using var provider = services.BuildServiceProvider();
|
||||||
|
var useCase = provider.GetRequiredService<IGetFurnitureAvailabilityUseCase>();
|
||||||
|
|
||||||
|
var response = await useCase.HandleAsync(new GetFurnitureAvailabilityRequest("FURN-001", "corr-123"));
|
||||||
|
|
||||||
|
Assert.Equal("FURN-001", response.FurnitureId);
|
||||||
|
Assert.Equal("Contoso Lounge Chair", response.DisplayName);
|
||||||
Assert.Equal(8, response.QuantityAvailable);
|
Assert.Equal(8, response.QuantityAvailable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user