Add Status to InsertResultCommand for query outcome reporting
Enhance PostprocessingBehavior and PreprocessingBehavior to set the Status property on InsertResultCommand. Status is now set to QuerySuccess on successful execution and QueryFailed on exceptions, improving clarity of query execution results.
This commit is contained in:
@@ -23,6 +23,7 @@ public class PostprocessingBehavior(IRecDbContext context, ISender sender) : IPi
|
|||||||
|
|
||||||
await sender.Send(new InsertResultCommand()
|
await sender.Send(new InsertResultCommand()
|
||||||
{
|
{
|
||||||
|
Status = Status.QuerySuccess,
|
||||||
ActionId = request.Action.Id,
|
ActionId = request.Action.Id,
|
||||||
Info = info,
|
Info = info,
|
||||||
Type = ResultType.Post
|
Type = ResultType.Post
|
||||||
@@ -35,6 +36,7 @@ public class PostprocessingBehavior(IRecDbContext context, ISender sender) : IPi
|
|||||||
|
|
||||||
await sender.Send(new InsertResultCommand()
|
await sender.Send(new InsertResultCommand()
|
||||||
{
|
{
|
||||||
|
Status = Status.QueryFailed,
|
||||||
ActionId = request.Action.Id,
|
ActionId = request.Action.Id,
|
||||||
Error = error,
|
Error = error,
|
||||||
Type = ResultType.Post
|
Type = ResultType.Post
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ public class PreprocessingBehavior(IRecDbContext context, ISender sender) : IPip
|
|||||||
|
|
||||||
await sender.Send(new InsertResultCommand()
|
await sender.Send(new InsertResultCommand()
|
||||||
{
|
{
|
||||||
|
Status = Status.QuerySuccess,
|
||||||
ActionId = request.Action.Id,
|
ActionId = request.Action.Id,
|
||||||
Info = JsonSerializer.Serialize(result),
|
Info = JsonSerializer.Serialize(result),
|
||||||
Type = ResultType.Pre
|
Type = ResultType.Pre
|
||||||
@@ -30,6 +31,7 @@ public class PreprocessingBehavior(IRecDbContext context, ISender sender) : IPip
|
|||||||
{
|
{
|
||||||
await sender.Send(new InsertResultCommand()
|
await sender.Send(new InsertResultCommand()
|
||||||
{
|
{
|
||||||
|
Status = Status.QueryFailed,
|
||||||
ActionId = request.Action.Id,
|
ActionId = request.Action.Id,
|
||||||
Error = ex.ToString(),
|
Error = ex.ToString(),
|
||||||
Type = ResultType.Pre
|
Type = ResultType.Pre
|
||||||
|
|||||||
Reference in New Issue
Block a user