chore(furniture-dal): checkpoint pending development updates
This commit is contained in:
parent
97de9e9b29
commit
ff28fe83c3
9
.dockerignore
Normal file
9
.dockerignore
Normal file
@ -0,0 +1,9 @@
|
||||
**/bin/
|
||||
**/obj/
|
||||
.vs/
|
||||
TestResults/
|
||||
.git/
|
||||
.repo-tasks/
|
||||
.repo-context/
|
||||
.tasks/
|
||||
.agile/
|
||||
20
Dockerfile
Normal file
20
Dockerfile
Normal file
@ -0,0 +1,20 @@
|
||||
# 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.DAL.Host/Furniture.DAL.Host.csproj" --configfile /root/.nuget/NuGet/NuGet.Config
|
||||
RUN dotnet publish "src/Furniture.DAL.Host/Furniture.DAL.Host.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", "Furniture.DAL.Host.dll"]
|
||||
@ -1,5 +1,6 @@
|
||||
<Solution>
|
||||
<Folder Name="/src/">
|
||||
<Project Path="src/Furniture.DAL.Host/Furniture.DAL.Host.csproj" />
|
||||
<Project Path="src/Furniture.DAL/Furniture.DAL.csproj" />
|
||||
</Folder>
|
||||
<Folder Name="/tests/">
|
||||
|
||||
@ -15,7 +15,7 @@ Remove cross-repo source coupling from `Furniture.DAL` and consume shared contra
|
||||
|
||||
Repository-level `nuget.config` includes:
|
||||
|
||||
- `gitea-org`: `http://192.168.10.100:3000/api/packages/AgileWebs/nuget/index.json`
|
||||
- `gitea-org`: `https://gitea.dream-views.com/api/packages/AgileWebs/nuget/index.json`
|
||||
- `nuget.org`
|
||||
|
||||
Because feed is currently HTTP, `allowInsecureConnections="true"` is required for the Gitea source.
|
||||
|
||||
18
docs/roadmap/feature-epics.md
Normal file
18
docs/roadmap/feature-epics.md
Normal file
@ -0,0 +1,18 @@
|
||||
# Feature Epics
|
||||
|
||||
## Repository
|
||||
furniture-dal
|
||||
|
||||
## 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.
|
||||
39
docs/runbooks/containerization.md
Normal file
39
docs/runbooks/containerization.md
Normal file
@ -0,0 +1,39 @@
|
||||
# Containerization Runbook
|
||||
|
||||
## Image Build
|
||||
|
||||
```bash
|
||||
docker build --build-arg NUGET_FEED_USERNAME=<gitea-login> --build-arg NUGET_FEED_TOKEN=<gitea-token> -t agilewebs/furniture-dal:dev .
|
||||
```
|
||||
|
||||
## Local Run
|
||||
|
||||
```bash
|
||||
docker run --rm -p 8080:8080 --name furniture-dal agilewebs/furniture-dal:dev
|
||||
```
|
||||
|
||||
## Health Probe
|
||||
|
||||
- Path: `/health`
|
||||
- Fallback path: `/healthz`
|
||||
- Port: `8080`
|
||||
|
||||
## Runtime Notes
|
||||
|
||||
- Exposes internal DAL lookup endpoints for furniture availability and catalog projections.
|
||||
- In-memory demo provider accepts canonical demo IDs (`FURN-001..003`) and aliases (`demo-context`, `FUR-*`, `PRD-*`, `PROD-FURN-*`).
|
||||
|
||||
## 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.
|
||||
@ -2,7 +2,7 @@
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="gitea-org" value="http://192.168.10.100:3000/api/packages/AgileWebs/nuget/index.json" allowInsecureConnections="true" />
|
||||
<add key="gitea-org" value="https://gitea.dream-views.com/api/packages/AgileWebs/nuget/index.json" allowInsecureConnections="true" />
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
</configuration>
|
||||
|
||||
13
src/Furniture.DAL.Host/Furniture.DAL.Host.csproj
Normal file
13
src/Furniture.DAL.Host/Furniture.DAL.Host.csproj
Normal file
@ -0,0 +1,13 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Furniture.DAL\Furniture.DAL.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
53
src/Furniture.DAL.Host/Program.cs
Normal file
53
src/Furniture.DAL.Host/Program.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using Furniture.DAL.Contracts;
|
||||
using Furniture.DAL.DependencyInjection;
|
||||
using Furniture.DAL.Repositories;
|
||||
using Microsoft.Extensions.Primitives;
|
||||
|
||||
const string CorrelationHeaderName = "x-correlation-id";
|
||||
const string ContractVersion = "v1";
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
builder.Services.AddHealthChecks();
|
||||
builder.Services.AddFurnitureDalRuntime();
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
app.MapGet("/internal/furniture-dal/availability/{furnitureId}", async (
|
||||
string furnitureId,
|
||||
HttpContext context,
|
||||
IFurnitureRepository repository,
|
||||
CancellationToken ct) =>
|
||||
{
|
||||
var envelope = new FurnitureDalContractEnvelope(ContractVersion, ResolveCorrelationId(context));
|
||||
var request = new FurnitureAvailabilityLookupRequest(envelope, furnitureId);
|
||||
var record = await repository.ReadAvailabilityAsync(request, ct);
|
||||
return record is null ? Results.NotFound() : Results.Ok(record);
|
||||
});
|
||||
|
||||
app.MapGet("/internal/furniture-dal/catalog/{productId}", async (
|
||||
string productId,
|
||||
HttpContext context,
|
||||
ICatalogRepository repository,
|
||||
CancellationToken ct) =>
|
||||
{
|
||||
var envelope = new FurnitureDalContractEnvelope(ContractVersion, ResolveCorrelationId(context));
|
||||
var request = new CatalogProductLookupRequest(envelope, productId);
|
||||
var record = await repository.ReadProductAsync(request, ct);
|
||||
return record is null ? Results.NotFound() : Results.Ok(record);
|
||||
});
|
||||
|
||||
app.MapHealthChecks("/health");
|
||||
app.MapHealthChecks("/healthz");
|
||||
|
||||
app.Run();
|
||||
|
||||
static string ResolveCorrelationId(HttpContext context)
|
||||
{
|
||||
if (context.Request.Headers.TryGetValue(CorrelationHeaderName, out var headerValue) &&
|
||||
!StringValues.IsNullOrEmpty(headerValue))
|
||||
{
|
||||
return headerValue.ToString();
|
||||
}
|
||||
|
||||
return context.TraceIdentifier;
|
||||
}
|
||||
23
src/Furniture.DAL.Host/Properties/launchSettings.json
Normal file
23
src/Furniture.DAL.Host/Properties/launchSettings.json
Normal file
@ -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"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
8
src/Furniture.DAL.Host/appsettings.Development.json
Normal file
8
src/Furniture.DAL.Host/appsettings.Development.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
}
|
||||
}
|
||||
9
src/Furniture.DAL.Host/appsettings.json
Normal file
9
src/Furniture.DAL.Host/appsettings.json
Normal file
@ -0,0 +1,9 @@
|
||||
{
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
"Microsoft.AspNetCore": "Warning"
|
||||
}
|
||||
},
|
||||
"AllowedHosts": "*"
|
||||
}
|
||||
@ -10,9 +10,24 @@ public sealed class InMemoryCatalogDataProvider : ICatalogDataProvider
|
||||
private static readonly IReadOnlyDictionary<string, string> DisplayNameByProductId =
|
||||
new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["PRD-001"] = "Contoso Lounge Chair",
|
||||
["PRD-002"] = "Fabrikam Office Desk",
|
||||
["PRD-003"] = "Northwind Shelf"
|
||||
["FURN-001"] = "Nordic Chair",
|
||||
["FURN-002"] = "Oak Dining Table",
|
||||
["FURN-003"] = "Bar Stool"
|
||||
};
|
||||
|
||||
private static readonly IReadOnlyDictionary<string, string> CanonicalProductIdAliases =
|
||||
new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["demo-context"] = "FURN-001",
|
||||
["FUR-001"] = "FURN-001",
|
||||
["FUR-002"] = "FURN-002",
|
||||
["FUR-003"] = "FURN-003",
|
||||
["PRD-001"] = "FURN-001",
|
||||
["PRD-002"] = "FURN-002",
|
||||
["PRD-003"] = "FURN-003",
|
||||
["PROD-FURN-001"] = "FURN-001",
|
||||
["PROD-FURN-002"] = "FURN-002",
|
||||
["PROD-FURN-003"] = "FURN-003"
|
||||
};
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -20,7 +35,8 @@ public sealed class InMemoryCatalogDataProvider : ICatalogDataProvider
|
||||
CatalogProductLookupRequest request,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (!DisplayNameByProductId.TryGetValue(request.ProductId, out var displayName))
|
||||
var canonicalProductId = ResolveCanonicalProductId(request.ProductId);
|
||||
if (!DisplayNameByProductId.TryGetValue(canonicalProductId, out var displayName))
|
||||
{
|
||||
return Task.FromResult<CatalogProductProjectionRecord?>(null);
|
||||
}
|
||||
@ -32,4 +48,14 @@ public sealed class InMemoryCatalogDataProvider : ICatalogDataProvider
|
||||
|
||||
return Task.FromResult<CatalogProductProjectionRecord?>(record);
|
||||
}
|
||||
|
||||
private static string ResolveCanonicalProductId(string productId)
|
||||
{
|
||||
if (CanonicalProductIdAliases.TryGetValue(productId, out var mappedId))
|
||||
{
|
||||
return mappedId;
|
||||
}
|
||||
|
||||
return productId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,9 +10,24 @@ public sealed class InMemoryFurnitureDataProvider : IFurnitureDataProvider
|
||||
private static readonly IReadOnlyDictionary<string, int> AvailabilityByFurnitureId =
|
||||
new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["FUR-001"] = 8,
|
||||
["FUR-002"] = 2,
|
||||
["FUR-003"] = 0
|
||||
["FURN-001"] = 22,
|
||||
["FURN-002"] = 11,
|
||||
["FURN-003"] = 18
|
||||
};
|
||||
|
||||
private static readonly IReadOnlyDictionary<string, string> CanonicalFurnitureIdAliases =
|
||||
new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["demo-context"] = "FURN-001",
|
||||
["FUR-001"] = "FURN-001",
|
||||
["FUR-002"] = "FURN-002",
|
||||
["FUR-003"] = "FURN-003",
|
||||
["PRD-001"] = "FURN-001",
|
||||
["PRD-002"] = "FURN-002",
|
||||
["PRD-003"] = "FURN-003",
|
||||
["PROD-FURN-001"] = "FURN-001",
|
||||
["PROD-FURN-002"] = "FURN-002",
|
||||
["PROD-FURN-003"] = "FURN-003"
|
||||
};
|
||||
|
||||
/// <inheritdoc />
|
||||
@ -20,7 +35,8 @@ public sealed class InMemoryFurnitureDataProvider : IFurnitureDataProvider
|
||||
FurnitureAvailabilityLookupRequest request,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (!AvailabilityByFurnitureId.TryGetValue(request.FurnitureId, out var quantityAvailable))
|
||||
var canonicalId = ResolveCanonicalFurnitureId(request.FurnitureId);
|
||||
if (!AvailabilityByFurnitureId.TryGetValue(canonicalId, out var quantityAvailable))
|
||||
{
|
||||
return Task.FromResult<FurnitureAvailabilityRecord?>(null);
|
||||
}
|
||||
@ -32,4 +48,14 @@ public sealed class InMemoryFurnitureDataProvider : IFurnitureDataProvider
|
||||
|
||||
return Task.FromResult<FurnitureAvailabilityRecord?>(record);
|
||||
}
|
||||
|
||||
private static string ResolveCanonicalFurnitureId(string furnitureId)
|
||||
{
|
||||
if (CanonicalFurnitureIdAliases.TryGetValue(furnitureId, out var mappedId))
|
||||
{
|
||||
return mappedId;
|
||||
}
|
||||
|
||||
return furnitureId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -21,17 +21,17 @@ public class RuntimeWiringTests
|
||||
var envelope = new FurnitureDalContractEnvelope("1.0.0", "corr-123");
|
||||
|
||||
var availability = await furnitureRepository.ReadAvailabilityAsync(
|
||||
new FurnitureAvailabilityLookupRequest(envelope, "FUR-001"));
|
||||
new FurnitureAvailabilityLookupRequest(envelope, "FURN-001"));
|
||||
var product = await catalogRepository.ReadProductAsync(
|
||||
new CatalogProductLookupRequest(envelope, "PRD-001"));
|
||||
new CatalogProductLookupRequest(envelope, "PROD-FURN-001"));
|
||||
|
||||
Assert.NotNull(availability);
|
||||
Assert.Equal("FUR-001", availability.FurnitureId);
|
||||
Assert.Equal(8, availability.QuantityAvailable);
|
||||
Assert.Equal("FURN-001", availability.FurnitureId);
|
||||
Assert.Equal(22, availability.QuantityAvailable);
|
||||
|
||||
Assert.NotNull(product);
|
||||
Assert.Equal("PRD-001", product.ProductId);
|
||||
Assert.Equal("Contoso Lounge Chair", product.DisplayName);
|
||||
Assert.Equal("PROD-FURN-001", product.ProductId);
|
||||
Assert.Equal("Nordic Chair", product.DisplayName);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@ -45,16 +45,16 @@ public class RuntimeWiringTests
|
||||
var projectionAdapter = provider.GetRequiredService<ICatalogProjectionContractAdapter>();
|
||||
|
||||
var availabilityRequest = grpcAdapter.FromGrpcAvailabilityRequest(
|
||||
new Furniture.DAL.Grpc.FurnitureAvailabilityDalGrpcContract("FUR-002"));
|
||||
new Furniture.DAL.Grpc.FurnitureAvailabilityDalGrpcContract("FURN-002"));
|
||||
var catalogRequest = projectionAdapter.ToDalRequest(
|
||||
new BuildingBlock.Catalog.Contracts.Products.ProductContract(
|
||||
new BuildingBlock.Catalog.Contracts.Conventions.CatalogContractEnvelope("1.0.0", "corr-456"),
|
||||
"PRD-002",
|
||||
"Fabrikam Office Desk"));
|
||||
"PROD-FURN-002",
|
||||
"Oak Dining Table"));
|
||||
|
||||
Assert.Equal("FUR-002", availabilityRequest.FurnitureId);
|
||||
Assert.Equal("FURN-002", availabilityRequest.FurnitureId);
|
||||
Assert.NotEmpty(availabilityRequest.Envelope.CorrelationId);
|
||||
Assert.Equal("PRD-002", catalogRequest.ProductId);
|
||||
Assert.Equal("PROD-FURN-002", catalogRequest.ProductId);
|
||||
Assert.Equal("corr-456", catalogRequest.Envelope.CorrelationId);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user