Compare commits

...

8 Commits

Author SHA1 Message Date
165152b7cf Merge branch 'master' of http://git.dd:3000/AppStd/ReC 2025-12-12 09:18:27 +01:00
f1f9e8d791 Bump version to 1.0.3-beta in ReC.API.csproj
Updated <Version>, <AssemblyVersion>, <FileVersion>, and <InformationalVersion> fields in the project file from 1.0.2-beta to 1.0.3-beta. No other changes were made.
2025-12-12 01:54:43 +01:00
35171add0c Add ErrorAction to RecActionDto and batch error handling
Introduce ErrorAction property to RecActionDto for per-action error handling. Update InvokeRecActionsCommandHandler to check invocation results and use ErrorAction to determine whether to continue or stop on failure, enabling configurable batch processing behavior.

Add ErrorAction to RecActionDto and batch error handling

Introduce ErrorAction property to RecActionDto for per-action error handling. Update InvokeRecActionsCommandHandler to check invocation results and use ErrorAction to determine whether to continue or stop processing on failure. This enables configurable error handling in batch action execution.
2025-12-12 01:52:35 +01:00
030dcf8b58 Add ErrorAction property to RecAction and DB mapping
Added the ErrorAction property to the RecAction class for specifying error handling actions. Updated RecDbContext to map this property to the ERROR_ACTION database column.
2025-12-12 01:47:43 +01:00
71411d4027 Update InvokeRecActionCommand to return success status
Changed InvokeRecActionCommand and its handler to return a boolean indicating success or failure, allowing consumers to check if the action was successful. This improves clarity and error handling in command execution.
2025-12-12 01:43:01 +01:00
da1b05347e Add Status and Message to CreateOutResCommand
CreateOutResCommand now includes optional Status and Message properties to capture additional result details. The HTTP response status code is recorded in Status when creating an output result in InvokeRecActionCommandHandler.
2025-12-12 01:32:09 +01:00
d932fb522c Add Status and Message columns to entity mapping
Added Status and Message properties to the entity configuration in RecDbContext.cs, mapping them to the STATUS and MESSAGE database columns. This allows the entity to store and retrieve these additional fields.
2025-12-12 01:28:29 +01:00
134a808633 Add Status, Message, and Header to OutRes class
Added three new nullable properties—Status (short), Message (string), and Header (string)—to the OutRes class to support additional metadata and state information.
2025-12-12 01:25:29 +01:00
8 changed files with 38 additions and 8 deletions

View File

@@ -10,10 +10,10 @@
<Product>ReC.API</Product>
<PackageIcon>Assets\icon.ico</PackageIcon>
<PackageTags>digital data rest-caller rec api</PackageTags>
<Version>1.0.2-beta</Version>
<AssemblyVersion>1.0.2.0</AssemblyVersion>
<FileVersion>1.0.2.0</FileVersion>
<InformationalVersion>1.0.0-beta</InformationalVersion>
<Version>1.0.3-beta</Version>
<AssemblyVersion>1.0.3.0</AssemblyVersion>
<FileVersion>1.0.3.0</FileVersion>
<InformationalVersion>1.0.3-beta</InformationalVersion>
<Copyright>Copyright © 2025 Digital Data GmbH. All rights reserved.</Copyright>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn);1591</NoWarn>

View File

@@ -62,6 +62,8 @@ public record RecActionDto
public string? PostprocessingQuery { get; init; }
public string? ErrorAction { get; init; }
public UriBuilder ToEndpointUriBuilder()
{
var builder = EndpointUri is null ? new UriBuilder() : new UriBuilder(EndpointUri);

View File

@@ -8,6 +8,10 @@ public class CreateOutResCommand : IRequest
{
public required long ActionId { get; set; }
public short? Status { get; set; }
public string? Message { get; set; }
public string? Header { get; set; }
public string? Body { get; set; }

View File

@@ -18,6 +18,16 @@ public class InvokeRecActionsCommandHandler(ISender sender) : IRequestHandler<In
var actions = await sender.Send(request.ToReadQuery(q => q.Invoked = false), cancel);
foreach (var action in actions)
await sender.Send(action.ToInvokeCommand(), cancel);
{
var ok = await sender.Send(action.ToInvokeCommand(), cancel);
if (!ok)
switch (action.ErrorAction?.ToLowerInvariant())
{
case "continue":
break;
default:
return;
}
}
}
}

View File

@@ -8,7 +8,7 @@ using System.Text.Json;
namespace ReC.Application.RecActions.Commands;
public record InvokeRecActionCommand : IRequest
public record InvokeRecActionCommand : IRequest<bool>
{
public RecActionDto Action { get; set; } = null!;
}
@@ -22,9 +22,9 @@ public class InvokeRecActionCommandHandler(
ISender sender,
IHttpClientFactory clientFactory,
IConfiguration? config = null
) : IRequestHandler<InvokeRecActionCommand>
) : IRequestHandler<InvokeRecActionCommand, bool>
{
public async Task Handle(InvokeRecActionCommand request, CancellationToken cancel)
public async Task<bool> Handle(InvokeRecActionCommand request, CancellationToken cancel)
{
var action = request.Action;
using var http = clientFactory.CreateClient();
@@ -54,12 +54,17 @@ public class InvokeRecActionCommandHandler(
var resBody = await response.Content.ReadAsStringAsync(cancel);
var resHeaders = response.Headers.ToDictionary();
var statusCode = (short)response.StatusCode;
await sender.Send(new CreateOutResCommand
{
Status = statusCode,
ActionId = action.Id,
Header = JsonSerializer.Serialize(resHeaders, options: new() { WriteIndented = false }),
Body = resBody,
AddedWho = config?["AddedWho"]
}, cancel);
return response.IsSuccessStatusCode;
}
}

View File

@@ -8,6 +8,10 @@ public class OutRes
public RecAction? Action { get; set; }
public short? Status { get; set; }
public string? Message { get; set; }
public string? Header { get; set; }
public string? Body { get; set; }

View File

@@ -36,6 +36,8 @@ public class RecAction
public string? PostprocessingQuery { get; set; }
public string? ErrorAction { get; set; }
public string? AddedWho { get; set; }
public DateTime? AddedWhen { get; set; }

View File

@@ -131,6 +131,8 @@ public class RecDbContext(DbContextOptions<RecDbContext> options) : DbContext(op
.ValueGeneratedOnAdd();
b.Property(e => e.ActionId).HasColumnName("ACTION_ID");
b.Property(e => e.Status).HasColumnName("STATUS");
b.Property(e => e.Message).HasColumnName("MESSAGE");
b.Property(e => e.Header).HasColumnName("RESULT_HEADER");
b.Property(e => e.Body).HasColumnName("RESULT_BODY");
b.Property(e => e.AddedWho).HasColumnName("ADDED_WHO");
@@ -181,6 +183,7 @@ public class RecDbContext(DbContextOptions<RecDbContext> options) : DbContext(op
b.Property(e => e.HeaderQuery).HasColumnName("HEADER_QUERY");
b.Property(e => e.BodyQuery).HasColumnName("BODY_QUERY");
b.Property(e => e.PostprocessingQuery).HasColumnName("POSTPROCESSING_QUERY");
b.Property(e => e.ErrorAction).HasColumnName("ERROR_ACTION");
b.Property(e => e.AddedWho).HasColumnName("ADDED_WHO");
b.Property(e => e.AddedWhen).HasColumnName("ADDED_WHEN");
b.Property(e => e.ChangedWho).HasColumnName("CHANGED_WHO");