release orchestrator v1 draft and build fixes
This commit is contained in:
@@ -816,7 +816,7 @@ static void ConfigureEndpoints(WebApplication app)
|
||||
.RequireAuthorization(NotifyPolicies.Viewer)
|
||||
.RequireRateLimiting(NotifyRateLimitPolicies.DeliveryHistory);
|
||||
|
||||
apiGroup.MapPost("/digests", async ([FromBody] DigestUpsertRequest? request, IDigestRepository repository, HttpContext context, CancellationToken cancellationToken) =>
|
||||
apiGroup.MapPost("/digests", async ([FromBody] DigestUpsertRequest? request, IDigestRepository repository, TimeProvider timeProvider, StellaOps.Determinism.IGuidProvider guidProvider, HttpContext context, CancellationToken cancellationToken) =>
|
||||
{
|
||||
if (!TryResolveTenant(context, tenantHeader, out var tenant, out var error))
|
||||
{
|
||||
@@ -843,11 +843,12 @@ static void ConfigureEndpoints(WebApplication app)
|
||||
return Results.BadRequest(new { error = "digestKey is required." });
|
||||
}
|
||||
|
||||
var collectUntil = request.CollectUntil ?? DateTimeOffset.UtcNow.AddHours(1);
|
||||
var now = timeProvider.GetUtcNow();
|
||||
var collectUntil = request.CollectUntil ?? now.AddHours(1);
|
||||
var eventsJson = request.Events?.ToJsonString() ?? "[]";
|
||||
var digest = new DigestEntity
|
||||
{
|
||||
Id = Guid.NewGuid(),
|
||||
Id = guidProvider.NewGuid(),
|
||||
TenantId = tenant,
|
||||
ChannelId = channelIdGuid,
|
||||
Recipient = request.Recipient,
|
||||
@@ -857,8 +858,8 @@ static void ConfigureEndpoints(WebApplication app)
|
||||
Status = DigestStatus.Collecting,
|
||||
CollectUntil = collectUntil,
|
||||
SentAt = null,
|
||||
CreatedAt = DateTimeOffset.UtcNow,
|
||||
UpdatedAt = DateTimeOffset.UtcNow
|
||||
CreatedAt = now,
|
||||
UpdatedAt = now
|
||||
};
|
||||
|
||||
var saved = await repository.UpsertAsync(digest, cancellationToken).ConfigureAwait(false);
|
||||
@@ -925,7 +926,7 @@ static void ConfigureEndpoints(WebApplication app)
|
||||
})
|
||||
.RequireAuthorization(NotifyPolicies.Operator);
|
||||
|
||||
apiGroup.MapPost("/audit", async ([FromBody] JsonNode? body, INotifyAuditRepository repository, HttpContext context, ClaimsPrincipal user, CancellationToken cancellationToken) =>
|
||||
apiGroup.MapPost("/audit", async ([FromBody] JsonNode? body, INotifyAuditRepository repository, TimeProvider timeProvider, HttpContext context, ClaimsPrincipal user, CancellationToken cancellationToken) =>
|
||||
{
|
||||
if (!TryResolveTenant(context, tenantHeader, out var tenant, out var error))
|
||||
{
|
||||
@@ -952,7 +953,7 @@ static void ConfigureEndpoints(WebApplication app)
|
||||
ResourceId = body["entityId"]?.GetValue<string>(),
|
||||
Details = body["payload"]?.ToJsonString(),
|
||||
CorrelationId = context.TraceIdentifier,
|
||||
CreatedAt = DateTimeOffset.UtcNow
|
||||
CreatedAt = timeProvider.GetUtcNow()
|
||||
};
|
||||
|
||||
var id = await repository.CreateAsync(entry, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../../__Libraries/StellaOps.Configuration/StellaOps.Configuration.csproj" />
|
||||
<ProjectReference Include="../../__Libraries/StellaOps.DependencyInjection/StellaOps.DependencyInjection.csproj" />
|
||||
<ProjectReference Include="../../__Libraries/StellaOps.Determinism.Abstractions/StellaOps.Determinism.Abstractions.csproj" />
|
||||
<ProjectReference Include="../__Libraries/StellaOps.Notify.Models/StellaOps.Notify.Models.csproj" />
|
||||
<ProjectReference Include="../__Libraries/StellaOps.Notify.Persistence/StellaOps.Notify.Persistence.csproj" />
|
||||
<ProjectReference Include="../__Libraries/StellaOps.Notify.Engine/StellaOps.Notify.Engine.csproj" />
|
||||
|
||||
@@ -39,7 +39,7 @@ public sealed class NotifyWorkerOptions
|
||||
/// </summary>
|
||||
public TimeSpan FailureBackoffDelay { get; set; } = TimeSpan.FromSeconds(5);
|
||||
|
||||
internal string ResolveWorkerId()
|
||||
internal string ResolveWorkerId(Guid? fallbackGuid = null)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(WorkerId))
|
||||
{
|
||||
@@ -47,6 +47,6 @@ public sealed class NotifyWorkerOptions
|
||||
}
|
||||
|
||||
var host = Environment.MachineName;
|
||||
return $"{host}-{Guid.NewGuid():n}";
|
||||
return $"{host}-{(fallbackGuid ?? Guid.NewGuid()):n}";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user