From 0afe9870c04fd5fab5ee7d525e696736774bfd1d Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 15 Dec 2025 12:01:39 +0100 Subject: [PATCH] Update RecActionView model and mapping for enums and names Refactored RecActionView to use enum types for EndpointAuthType, ApiKeyLocation, and RestType, and added properties for their display names. Introduced ErrorAction and its display name. Updated RecDbContext mapping to treat RecActionView as a view with a key, map new enum ID and name fields, and align property mappings with the database view structure. This enhances clarity and supports both ID and human-readable values in the model. --- src/ReC.Domain/Entities/RecActionView.cs | 12 +++++++++++- src/ReC.Infrastructure/RecDbContext.cs | 17 +++++++++++------ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/ReC.Domain/Entities/RecActionView.cs b/src/ReC.Domain/Entities/RecActionView.cs index 8067d7c..d5a53d9 100644 --- a/src/ReC.Domain/Entities/RecActionView.cs +++ b/src/ReC.Domain/Entities/RecActionView.cs @@ -44,12 +44,16 @@ public class RecActionView public EndpointAuthType? EndpointAuthType { get; set; } + public string? EndpointAuthTypeName { get; set; } + public string? EndpointAuthApiKey { get; set; } public string? EndpointAuthApiValue { get; set; } public ApiKeyLocation? EndpointAuthApiKeyAddTo { get; set; } + public string? EndpointAuthApiKeyAddToName { get; set; } + public string? EndpointAuthToken { get; set; } public string? EndpointAuthUsername { get; set; } @@ -75,7 +79,9 @@ public class RecActionView public string? SqlConnectionPassword { get; set; } - public string? RestType { get; set; } + public RestType? RestType { get; set; } + + public string? RestTypeName { get; set; } public string? PreprocessingQuery { get; set; } @@ -84,4 +90,8 @@ public class RecActionView public string? BodyQuery { get; set; } public string? PostprocessingQuery { get; set; } + + public ErrorAction? ErrorAction { get; set; } + + public string? ErrorActionName { get; set; } } \ No newline at end of file diff --git a/src/ReC.Infrastructure/RecDbContext.cs b/src/ReC.Infrastructure/RecDbContext.cs index d84daf8..a38340b 100644 --- a/src/ReC.Infrastructure/RecDbContext.cs +++ b/src/ReC.Infrastructure/RecDbContext.cs @@ -196,10 +196,10 @@ public class RecDbContext(DbContextOptions options) : DbContext(op modelBuilder.Entity(b => { - b.ToTable("VWREC_ACTION", "dbo"); - b.HasNoKey(); + b.ToView("VWREC_ACTION", "dbo"); + b.HasKey(e => e.Id); - b.Property(e => e.Id).HasColumnName("ACTION_ID"); + b.Property(e => e.Id).HasColumnName("ACTION_GUID"); b.Property(e => e.ProfileId).HasColumnName("PROFILE_ID"); b.Property(e => e.ProfileName).HasColumnName("PROFILE_NAME"); b.Property(e => e.ProfileType).HasColumnName("PROFILE_TYPE"); @@ -207,10 +207,12 @@ public class RecDbContext(DbContextOptions options) : DbContext(op b.Property(e => e.EndpointId).HasColumnName("ENDPOINT_ID"); b.Property(e => e.EndpointUri).HasColumnName("ENDPOINT_URI"); b.Property(e => e.EndpointAuthId).HasColumnName("ENDPOINT_AUTH_ID"); - b.Property(e => e.EndpointAuthType).HasColumnName("ENDPOINT_AUTH_TYPE"); + b.Property(e => e.EndpointAuthType).HasColumnName("ENDPOINT_AUTH_TYPE_ID"); + b.Property(e => e.EndpointAuthTypeName).HasColumnName("ENDPOINT_AUTH_TYPE"); b.Property(e => e.EndpointAuthApiKey).HasColumnName("ENDPOINT_AUTH_API_KEY"); b.Property(e => e.EndpointAuthApiValue).HasColumnName("ENDPOINT_AUTH_API_VALUE"); - b.Property(e => e.EndpointAuthApiKeyAddTo).HasColumnName("ENDPOINT_AUTH_API_KEY_ADD_TO"); + b.Property(e => e.EndpointAuthApiKeyAddTo).HasColumnName("ENDPOINT_AUTH_API_KEY_ADD_TO_ID"); + b.Property(e => e.EndpointAuthApiKeyAddToName).HasColumnName("ENDPOINT_AUTH_API_KEY_ADD_TO"); b.Property(e => e.EndpointAuthToken).HasColumnName("ENDPOINT_AUTH_TOKEN"); b.Property(e => e.EndpointAuthUsername).HasColumnName("ENDPOINT_AUTH_USERNAME"); b.Property(e => e.EndpointAuthPassword).HasColumnName("ENDPOINT_AUTH_PASSWORD"); @@ -222,11 +224,14 @@ public class RecDbContext(DbContextOptions options) : DbContext(op b.Property(e => e.SqlConnectionDb).HasColumnName("SQL_CONNECTION_DB"); b.Property(e => e.SqlConnectionUsername).HasColumnName("SQL_CONNECTION_USERNAME"); b.Property(e => e.SqlConnectionPassword).HasColumnName("SQL_CONNECTION_PASSWORD"); - b.Property(e => e.RestType).HasColumnName("REST_TYPE"); + b.Property(e => e.RestType).HasColumnName("REST_TYPE_ID"); + b.Property(e => e.RestTypeName).HasColumnName("REST_TYPE"); b.Property(e => e.PreprocessingQuery).HasColumnName("PREPROCESSING_QUERY"); b.Property(e => e.HeaderQuery).HasColumnName("HEADER_QUERY"); b.Property(e => e.BodyQuery).HasColumnName("BODY_QUERY"); b.Property(e => e.PostprocessingQuery).HasColumnName("POSTPROCESSING_QUERY"); + b.Property(e => e.ErrorAction).HasColumnName("ERROR_ACTION_ID"); + b.Property(e => e.ErrorActionName).HasColumnName("ERROR_ACTION"); }); modelBuilder.Entity(b =>