Remove query execution tracking properties
Simplified the codebase by removing `BodyQueryExecuted`, `HeaderQueryExecuted`, and related computed properties (`IsBodyQueryReturnedNoData` and `IsHeaderQueryReturnedNoData`) from `RecActionDto`. These properties were used to track whether `BodyQuery` and `HeaderQuery` were executed and whether they returned data. Updated `BodyQueryBehavior` and `HeaderQueryBehavior` to remove logic that set these properties. Also removed the conditional block in `InvokeRecActionCommandHandler` that logged warnings based on these properties. These changes streamline the code and reflect a shift away from tracking query execution and results at this level.
This commit is contained in:
parent
90e2460716
commit
2610fc8f07
@ -15,8 +15,6 @@ public class BodyQueryBehavior<TRecAction>(IRecDbContext dbContext) : IPipelineB
|
|||||||
|
|
||||||
var result = await dbContext.BodyQueryResults.FromSqlRaw(action.BodyQuery).SingleOrDefaultAsync(cancel);
|
var result = await dbContext.BodyQueryResults.FromSqlRaw(action.BodyQuery).SingleOrDefaultAsync(cancel);
|
||||||
|
|
||||||
action.BodyQueryExecuted = true;
|
|
||||||
|
|
||||||
action.Body = result?.RawBody;
|
action.Body = result?.RawBody;
|
||||||
|
|
||||||
return await next(cancel);
|
return await next(cancel);
|
||||||
|
|||||||
@ -17,8 +17,6 @@ public class HeaderQueryBehavior<TRecAction>(IRecDbContext dbContext, ILogger<He
|
|||||||
|
|
||||||
var result = await dbContext.HeaderQueryResults.FromSqlRaw(action.HeaderQuery).SingleOrDefaultAsync(cancel);
|
var result = await dbContext.HeaderQueryResults.FromSqlRaw(action.HeaderQuery).SingleOrDefaultAsync(cancel);
|
||||||
|
|
||||||
action.HeaderQueryExecuted = true;
|
|
||||||
|
|
||||||
if (result?.RawHeader is null)
|
if (result?.RawHeader is null)
|
||||||
{
|
{
|
||||||
logger?.LogWarning("Header query did not return a result or returned a null REQUEST_HEADER. Profile ID: {ProfileId}, Action ID: {ActionId}", action.ProfileId, action.ActionId);
|
logger?.LogWarning("Header query did not return a result or returned a null REQUEST_HEADER. Profile ID: {ProfileId}, Action ID: {ActionId}", action.ProfileId, action.ActionId);
|
||||||
|
|||||||
@ -54,20 +54,12 @@ public record RecActionDto
|
|||||||
|
|
||||||
public string? HeaderQuery { get; init; }
|
public string? HeaderQuery { get; init; }
|
||||||
|
|
||||||
public bool HeaderQueryExecuted { get; set; } = false;
|
|
||||||
|
|
||||||
public bool IsHeaderQueryReturnedNoData => HeaderQueryExecuted && HeaderQuery is null;
|
|
||||||
|
|
||||||
public Dictionary<string, string>? Headers { get; set; }
|
public Dictionary<string, string>? Headers { get; set; }
|
||||||
|
|
||||||
public string? BodyQuery { get; init; }
|
public string? BodyQuery { get; init; }
|
||||||
|
|
||||||
public string? Body { get; set; }
|
public string? Body { get; set; }
|
||||||
|
|
||||||
public bool BodyQueryExecuted { get; set; } = false;
|
|
||||||
|
|
||||||
public bool IsBodyQueryReturnedNoData => BodyQueryExecuted && Body is null;
|
|
||||||
|
|
||||||
public string? PostprocessingQuery { get; init; }
|
public string? PostprocessingQuery { get; init; }
|
||||||
|
|
||||||
public UriBuilder ToEndpointUriBuilder()
|
public UriBuilder ToEndpointUriBuilder()
|
||||||
|
|||||||
@ -45,17 +45,6 @@ public class InvokeRecActionCommandHandler(
|
|||||||
using var reqBody = new StringContent(request.Body);
|
using var reqBody = new StringContent(request.Body);
|
||||||
httpReq.Content = reqBody;
|
httpReq.Content = reqBody;
|
||||||
}
|
}
|
||||||
else if(request.BodyQuery is not null && !request.IsBodyQueryReturnedNoData)
|
|
||||||
{
|
|
||||||
logger?.LogWarning(
|
|
||||||
"Although BodyQuery returns null, the IsReturnedNoData variable has not been set to TRUE. " +
|
|
||||||
"This indicates that BodyQueryBehavior has not been executed or that the relevant control step has been skipped. " +
|
|
||||||
"The relevant behavior must be verified to ensure that the process does not produce unexpected conditions. " +
|
|
||||||
"ProfileId: {ProfileId}, ActionId: {ActionId}",
|
|
||||||
request.ProfileId,
|
|
||||||
request.ActionId
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (request.Headers is not null)
|
if (request.Headers is not null)
|
||||||
foreach (var header in request.Headers)
|
foreach (var header in request.Headers)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user