From aef59def7fcb86cf49d8d848fd43c70677bfef66 Mon Sep 17 00:00:00 2001 From: TekH Date: Wed, 25 Mar 2026 11:17:38 +0100 Subject: [PATCH] Add ResultType to InsertResultCommand in all handlers Added the Type property (ResultType) to every InsertResultCommand sent in PostprocessingBehavior, PreprocessingBehavior, and InvokeRecActionViewCommand. This ensures each result now includes its context (Post, Pre, or Main), both in normal and exception flows. --- .../Common/Behaviors/Action/PostprocessingBehavior.cs | 6 ++++-- .../Common/Behaviors/Action/PreprocessingBehavior.cs | 6 ++++-- .../RecActions/Commands/InvokeRecActionViewCommand.cs | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/ReC.Application/Common/Behaviors/Action/PostprocessingBehavior.cs b/src/ReC.Application/Common/Behaviors/Action/PostprocessingBehavior.cs index fca5d06..0a13b46 100644 --- a/src/ReC.Application/Common/Behaviors/Action/PostprocessingBehavior.cs +++ b/src/ReC.Application/Common/Behaviors/Action/PostprocessingBehavior.cs @@ -24,7 +24,8 @@ public class PostprocessingBehavior(IRecDbContext context, ISender sender) : IPi await sender.Send(new InsertResultCommand() { ActionId = request.Action.Id, - Info = info + Info = info, + Type = ResultType.Post }, cancel); } } @@ -35,7 +36,8 @@ public class PostprocessingBehavior(IRecDbContext context, ISender sender) : IPi await sender.Send(new InsertResultCommand() { ActionId = request.Action.Id, - Error = error + Error = error, + Type = ResultType.Post }, cancel); if (request.Action.ErrorAction == ErrorAction.Stop) diff --git a/src/ReC.Application/Common/Behaviors/Action/PreprocessingBehavior.cs b/src/ReC.Application/Common/Behaviors/Action/PreprocessingBehavior.cs index ba33bda..9f76cd9 100644 --- a/src/ReC.Application/Common/Behaviors/Action/PreprocessingBehavior.cs +++ b/src/ReC.Application/Common/Behaviors/Action/PreprocessingBehavior.cs @@ -21,7 +21,8 @@ public class PreprocessingBehavior(IRecDbContext context, ISender sender) : IPip await sender.Send(new InsertResultCommand() { ActionId = request.Action.Id, - Info = JsonSerializer.Serialize(result) + Info = JsonSerializer.Serialize(result), + Type = ResultType.Pre }, cancel); } } @@ -30,7 +31,8 @@ public class PreprocessingBehavior(IRecDbContext context, ISender sender) : IPip await sender.Send(new InsertResultCommand() { ActionId = request.Action.Id, - Error = ex.ToString() + Error = ex.ToString(), + Type = ResultType.Pre }, cancel); if (request.Action.ErrorAction == ErrorAction.Stop) diff --git a/src/ReC.Application/RecActions/Commands/InvokeRecActionViewCommand.cs b/src/ReC.Application/RecActions/Commands/InvokeRecActionViewCommand.cs index 91afb85..e0e9cb3 100644 --- a/src/ReC.Application/RecActions/Commands/InvokeRecActionViewCommand.cs +++ b/src/ReC.Application/RecActions/Commands/InvokeRecActionViewCommand.cs @@ -149,7 +149,8 @@ public class InvokeRecActionViewCommandHandler( StatusId = statusCode, ActionId = action.Id, Header = JsonSerializer.Serialize(resHeaders, options: new() { WriteIndented = false }), - Body = resBody + Body = resBody, + Type = ResultType.Main }, cancel); } catch(Exception ex) @@ -157,7 +158,8 @@ public class InvokeRecActionViewCommandHandler( await sender.Send(new InsertResultCommand() { ActionId = action.Id, - Error = ex.ToString() + Error = ex.ToString(), + Type = ResultType.Main }, cancel); if (action.ErrorAction == ErrorAction.Stop)