using Operations.DAL.Contracts; using Operations.DAL.Repositories; var builder = WebApplication.CreateBuilder(args); builder.Services.AddHealthChecks(); builder.Services.AddSingleton(); var app = builder.Build(); app.MapGet("/internal/operations-dal/config", async ( string locationId, DateTime? effectiveAtUtc, IOperationsConfigRepository repository, CancellationToken ct) => { var effectiveAt = effectiveAtUtc ?? DateTime.UtcNow; var record = await repository.GetEffectiveAsync(locationId, effectiveAt, ct); return record is null ? Results.NotFound() : Results.Ok(record); }); app.MapPost("/internal/operations-dal/config", async ( OperationsConfigRecord record, IOperationsConfigRepository repository, CancellationToken ct) => { await repository.UpsertAsync(record, ct); return Results.Accepted($"/internal/operations-dal/config?locationId={Uri.EscapeDataString(record.LocationId)}", record); }); app.MapHealthChecks("/health"); app.MapHealthChecks("/healthz"); app.Run();