Add support for references in InvokeRecAction commands
Introduced the InvokeReferencesDto record to encapsulate up to five optional reference strings. Updated InvokeRecActionViewCommand to include an optional References property. Modified InvokeRecActionViewCommandHandler to pass these references to InsertResultCommand, ensuring reference data is associated with command execution and results.
This commit is contained in:
@@ -18,6 +18,16 @@ namespace ReC.Application.RecActions.Commands;
|
||||
public record InvokeRecActionViewCommand : IRequest
|
||||
{
|
||||
public RecActionViewDto Action { get; set; } = null!;
|
||||
public InvokeReferencesDto? References { get; set; }
|
||||
}
|
||||
|
||||
public record InvokeReferencesDto
|
||||
{
|
||||
public string? Reference1 { get; init; }
|
||||
public string? Reference2 { get; init; }
|
||||
public string? Reference3 { get; init; }
|
||||
public string? Reference4 { get; init; }
|
||||
public string? Reference5 { get; init; }
|
||||
}
|
||||
|
||||
public class InvokeRecActionViewCommandHandler(
|
||||
@@ -150,7 +160,8 @@ public class InvokeRecActionViewCommandHandler(
|
||||
Header = JsonSerializer.Serialize(resHeaders, options: new() { WriteIndented = false }),
|
||||
Body = resBody,
|
||||
Info = (short)response.StatusCode,
|
||||
Type = ResultType.Main
|
||||
Type = ResultType.Main,
|
||||
References = request.References
|
||||
}, cancel);
|
||||
}
|
||||
catch(Exception ex)
|
||||
@@ -160,7 +171,8 @@ public class InvokeRecActionViewCommandHandler(
|
||||
Status = RecStatus.Error,
|
||||
ActionId = action.Id,
|
||||
Error = ex.ToString(),
|
||||
Type = ResultType.Main
|
||||
Type = ResultType.Main,
|
||||
References = request.References
|
||||
}, cancel);
|
||||
|
||||
if (action.ErrorAction == ErrorAction.Stop)
|
||||
|
||||
Reference in New Issue
Block a user