Compare commits
8 Commits
00efb14f2c
...
165152b7cf
| Author | SHA1 | Date | |
|---|---|---|---|
| 165152b7cf | |||
| f1f9e8d791 | |||
| 35171add0c | |||
| 030dcf8b58 | |||
| 71411d4027 | |||
| da1b05347e | |||
| d932fb522c | |||
| 134a808633 |
@@ -10,10 +10,10 @@
|
|||||||
<Product>ReC.API</Product>
|
<Product>ReC.API</Product>
|
||||||
<PackageIcon>Assets\icon.ico</PackageIcon>
|
<PackageIcon>Assets\icon.ico</PackageIcon>
|
||||||
<PackageTags>digital data rest-caller rec api</PackageTags>
|
<PackageTags>digital data rest-caller rec api</PackageTags>
|
||||||
<Version>1.0.2-beta</Version>
|
<Version>1.0.3-beta</Version>
|
||||||
<AssemblyVersion>1.0.2.0</AssemblyVersion>
|
<AssemblyVersion>1.0.3.0</AssemblyVersion>
|
||||||
<FileVersion>1.0.2.0</FileVersion>
|
<FileVersion>1.0.3.0</FileVersion>
|
||||||
<InformationalVersion>1.0.0-beta</InformationalVersion>
|
<InformationalVersion>1.0.3-beta</InformationalVersion>
|
||||||
<Copyright>Copyright © 2025 Digital Data GmbH. All rights reserved.</Copyright>
|
<Copyright>Copyright © 2025 Digital Data GmbH. All rights reserved.</Copyright>
|
||||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||||
<NoWarn>$(NoWarn);1591</NoWarn>
|
<NoWarn>$(NoWarn);1591</NoWarn>
|
||||||
|
|||||||
@@ -62,6 +62,8 @@ public record RecActionDto
|
|||||||
|
|
||||||
public string? PostprocessingQuery { get; init; }
|
public string? PostprocessingQuery { get; init; }
|
||||||
|
|
||||||
|
public string? ErrorAction { get; init; }
|
||||||
|
|
||||||
public UriBuilder ToEndpointUriBuilder()
|
public UriBuilder ToEndpointUriBuilder()
|
||||||
{
|
{
|
||||||
var builder = EndpointUri is null ? new UriBuilder() : new UriBuilder(EndpointUri);
|
var builder = EndpointUri is null ? new UriBuilder() : new UriBuilder(EndpointUri);
|
||||||
|
|||||||
@@ -8,6 +8,10 @@ public class CreateOutResCommand : IRequest
|
|||||||
{
|
{
|
||||||
public required long ActionId { get; set; }
|
public required long ActionId { get; set; }
|
||||||
|
|
||||||
|
public short? Status { get; set; }
|
||||||
|
|
||||||
|
public string? Message { get; set; }
|
||||||
|
|
||||||
public string? Header { get; set; }
|
public string? Header { get; set; }
|
||||||
|
|
||||||
public string? Body { get; set; }
|
public string? Body { get; set; }
|
||||||
|
|||||||
@@ -18,6 +18,16 @@ public class InvokeRecActionsCommandHandler(ISender sender) : IRequestHandler<In
|
|||||||
var actions = await sender.Send(request.ToReadQuery(q => q.Invoked = false), cancel);
|
var actions = await sender.Send(request.ToReadQuery(q => q.Invoked = false), cancel);
|
||||||
|
|
||||||
foreach (var action in actions)
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,7 +8,7 @@ using System.Text.Json;
|
|||||||
|
|
||||||
namespace ReC.Application.RecActions.Commands;
|
namespace ReC.Application.RecActions.Commands;
|
||||||
|
|
||||||
public record InvokeRecActionCommand : IRequest
|
public record InvokeRecActionCommand : IRequest<bool>
|
||||||
{
|
{
|
||||||
public RecActionDto Action { get; set; } = null!;
|
public RecActionDto Action { get; set; } = null!;
|
||||||
}
|
}
|
||||||
@@ -22,9 +22,9 @@ public class InvokeRecActionCommandHandler(
|
|||||||
ISender sender,
|
ISender sender,
|
||||||
IHttpClientFactory clientFactory,
|
IHttpClientFactory clientFactory,
|
||||||
IConfiguration? config = null
|
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;
|
var action = request.Action;
|
||||||
using var http = clientFactory.CreateClient();
|
using var http = clientFactory.CreateClient();
|
||||||
@@ -54,12 +54,17 @@ public class InvokeRecActionCommandHandler(
|
|||||||
var resBody = await response.Content.ReadAsStringAsync(cancel);
|
var resBody = await response.Content.ReadAsStringAsync(cancel);
|
||||||
var resHeaders = response.Headers.ToDictionary();
|
var resHeaders = response.Headers.ToDictionary();
|
||||||
|
|
||||||
|
var statusCode = (short)response.StatusCode;
|
||||||
|
|
||||||
await sender.Send(new CreateOutResCommand
|
await sender.Send(new CreateOutResCommand
|
||||||
{
|
{
|
||||||
|
Status = statusCode,
|
||||||
ActionId = action.Id,
|
ActionId = action.Id,
|
||||||
Header = JsonSerializer.Serialize(resHeaders, options: new() { WriteIndented = false }),
|
Header = JsonSerializer.Serialize(resHeaders, options: new() { WriteIndented = false }),
|
||||||
Body = resBody,
|
Body = resBody,
|
||||||
AddedWho = config?["AddedWho"]
|
AddedWho = config?["AddedWho"]
|
||||||
}, cancel);
|
}, cancel);
|
||||||
|
|
||||||
|
return response.IsSuccessStatusCode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,6 +8,10 @@ public class OutRes
|
|||||||
|
|
||||||
public RecAction? Action { get; set; }
|
public RecAction? Action { get; set; }
|
||||||
|
|
||||||
|
public short? Status { get; set; }
|
||||||
|
|
||||||
|
public string? Message { get; set; }
|
||||||
|
|
||||||
public string? Header { get; set; }
|
public string? Header { get; set; }
|
||||||
|
|
||||||
public string? Body { get; set; }
|
public string? Body { get; set; }
|
||||||
|
|||||||
@@ -36,6 +36,8 @@ public class RecAction
|
|||||||
|
|
||||||
public string? PostprocessingQuery { get; set; }
|
public string? PostprocessingQuery { get; set; }
|
||||||
|
|
||||||
|
public string? ErrorAction { get; set; }
|
||||||
|
|
||||||
public string? AddedWho { get; set; }
|
public string? AddedWho { get; set; }
|
||||||
|
|
||||||
public DateTime? AddedWhen { get; set; }
|
public DateTime? AddedWhen { get; set; }
|
||||||
|
|||||||
@@ -131,6 +131,8 @@ public class RecDbContext(DbContextOptions<RecDbContext> options) : DbContext(op
|
|||||||
.ValueGeneratedOnAdd();
|
.ValueGeneratedOnAdd();
|
||||||
|
|
||||||
b.Property(e => e.ActionId).HasColumnName("ACTION_ID");
|
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.Header).HasColumnName("RESULT_HEADER");
|
||||||
b.Property(e => e.Body).HasColumnName("RESULT_BODY");
|
b.Property(e => e.Body).HasColumnName("RESULT_BODY");
|
||||||
b.Property(e => e.AddedWho).HasColumnName("ADDED_WHO");
|
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.HeaderQuery).HasColumnName("HEADER_QUERY");
|
||||||
b.Property(e => e.BodyQuery).HasColumnName("BODY_QUERY");
|
b.Property(e => e.BodyQuery).HasColumnName("BODY_QUERY");
|
||||||
b.Property(e => e.PostprocessingQuery).HasColumnName("POSTPROCESSING_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.AddedWho).HasColumnName("ADDED_WHO");
|
||||||
b.Property(e => e.AddedWhen).HasColumnName("ADDED_WHEN");
|
b.Property(e => e.AddedWhen).HasColumnName("ADDED_WHEN");
|
||||||
b.Property(e => e.ChangedWho).HasColumnName("CHANGED_WHO");
|
b.Property(e => e.ChangedWho).HasColumnName("CHANGED_WHO");
|
||||||
|
|||||||
Reference in New Issue
Block a user