Rename Status enum to RecStatus across the codebase

Refactored all usages of the Status enum to RecStatus to improve clarity and prevent naming conflicts with other status enums (e.g., HTTP status codes). Updated command handlers, behaviors, data models, and extension methods to use RecStatus, and adjusted related serialization logic accordingly. This makes the domain-specific status handling more explicit and maintainable.
This commit is contained in:
2026-03-30 11:35:22 +02:00
parent ce0e53baf6
commit acff0aca89
7 changed files with 13 additions and 13 deletions

View File

@@ -23,7 +23,7 @@ public class PostprocessingBehavior(IRecDbContext context, ISender sender) : IPi
await sender.Send(new InsertResultCommand()
{
Status = Status.QuerySuccess,
Status = RecStatus.QuerySuccess,
ActionId = request.Action.Id,
Info = info,
Type = ResultType.Post
@@ -36,7 +36,7 @@ public class PostprocessingBehavior(IRecDbContext context, ISender sender) : IPi
await sender.Send(new InsertResultCommand()
{
Status = Status.QueryFailed,
Status = RecStatus.QueryFailed,
ActionId = request.Action.Id,
Error = error,
Type = ResultType.Post

View File

@@ -20,7 +20,7 @@ public class PreprocessingBehavior(IRecDbContext context, ISender sender) : IPip
await sender.Send(new InsertResultCommand()
{
Status = Status.QuerySuccess,
Status = RecStatus.QuerySuccess,
ActionId = request.Action.Id,
Info = JsonSerializer.Serialize(result),
Type = ResultType.Pre
@@ -31,7 +31,7 @@ public class PreprocessingBehavior(IRecDbContext context, ISender sender) : IPip
{
await sender.Send(new InsertResultCommand()
{
Status = Status.QueryFailed,
Status = RecStatus.QueryFailed,
ActionId = request.Action.Id,
Error = ex.ToString(),
Type = ResultType.Pre

View File

@@ -157,7 +157,7 @@ public class InvokeRecActionViewCommandHandler(
{
await sender.Send(new InsertResultCommand()
{
Status = Status.QueryFailed,
Status = RecStatus.QueryFailed,
ActionId = action.Id,
Error = ex.ToString(),
Type = ResultType.Main

View File

@@ -7,7 +7,7 @@ namespace ReC.Application.Results.Commands;
public record InsertResultCommand : IInsertProcedure
{
public long? ActionId { get; set; }
public required Status Status { get; set; }
public required RecStatus Status { get; set; }
public string? Header { get; set; }
public string? Body { get; set; }
public string? Info { get; set; }

View File

@@ -11,7 +11,7 @@ namespace ReC.Domain.Constants;
/// </para>
/// </summary>
/// <seealso cref="StatusExtensions"/>
public enum Status : short
public enum RecStatus : short
{
/// <summary>
/// Indicates that a SQL query executed successfully (value 0).

View File

@@ -4,7 +4,7 @@ namespace ReC.Domain.Constants;
public static class StatusExtensions
{
public static HttpStatusCode? ToHttpStatusCode(this Status status)
public static HttpStatusCode? ToHttpStatusCode(this RecStatus status)
{
int code = (int)status;
@@ -22,13 +22,13 @@ public static class StatusExtensions
return value >= 200 && value <= 299;
}
public static bool IsSuccess(this Status status)
public static bool IsSuccess(this RecStatus status)
=> status switch
{
Status.QuerySuccess => true,
Status.QueryFailed => false,
RecStatus.QuerySuccess => true,
RecStatus.QueryFailed => false,
_ => status.ToHttpStatusCode() is HttpStatusCode httpStatus && httpStatus.IsSuccess()
};
public static Status ToStatus(this HttpStatusCode code) => (Status)(short)code;
public static RecStatus ToStatus(this HttpStatusCode code) => (RecStatus)(short)code;
}

View File

@@ -25,7 +25,7 @@ public class ResultView
public string? ProfileName { get; set; }
[Column("STATUS_ID")]
public Status Status { get; set; }
public RecStatus Status { get; set; }
[Column("STATUS")]
public string? StatusName { get; set; }