From 563375f6e3105bf5903c52e53590d586f0372a83 Mon Sep 17 00:00:00 2001 From: TekH Date: Wed, 14 Jan 2026 13:17:10 +0100 Subject: [PATCH] Refactor validator to use nested property accessors Update InsertObjectProcedureValidator to reference nested properties (e.g., x.Action.ProfileId instead of x.ActionProfileId) throughout all entity validation rules. Adjust .When conditions accordingly to match the new data model structure with grouped sub-objects. --- .../InsertObjectProcedureValidator.cs | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/ReC.Application/Common/Validations/InsertObjectProcedureValidator.cs b/src/ReC.Application/Common/Validations/InsertObjectProcedureValidator.cs index f84d915..153136a 100644 --- a/src/ReC.Application/Common/Validations/InsertObjectProcedureValidator.cs +++ b/src/ReC.Application/Common/Validations/InsertObjectProcedureValidator.cs @@ -16,11 +16,11 @@ public class InsertObjectProcedureValidator : AbstractValidator x.Entity == "ACTION", () => { - RuleFor(x => x.ActionProfileId) + RuleFor(x => x.Action.ProfileId) .NotNull() .WithMessage("ACTION requires ActionProfileId (maps to @pACTION_PROFILE_ID)."); - RuleFor(x => x.ActionEndpointId) + RuleFor(x => x.Action.EndpointId) .NotNull() .WithMessage("ACTION requires ActionEndpointId (maps to @pACTION_ENDPOINT_ID)."); }); @@ -28,7 +28,7 @@ public class InsertObjectProcedureValidator : AbstractValidator x.Entity == "ENDPOINT", () => { - RuleFor(x => x.EndpointUri) + RuleFor(x => x.Endpoint.Uri) .NotEmpty() .WithMessage("ENDPOINT requires EndpointUri (maps to @pENDPOINT_URI).") .MaximumLength(2000); @@ -37,28 +37,28 @@ public class InsertObjectProcedureValidator : AbstractValidator x.Entity == "PROFILE", () => { - RuleFor(x => x.ProfileName) + RuleFor(x => x.Profile.Name) .NotEmpty() .WithMessage("PROFILE requires ProfileName (maps to @pPROFILE_NAME).") .MaximumLength(50); - RuleFor(x => x.ProfileMandantor) + RuleFor(x => x.Profile.Mandantor) .MaximumLength(50) - .When(x => x.ProfileMandantor != null); + .When(x => x.Profile.Mandantor != null); - RuleFor(x => x.ProfileDescription) + RuleFor(x => x.Profile.Description) .MaximumLength(250) - .When(x => x.ProfileDescription != null); + .When(x => x.Profile.Description != null); }); // RESULT validation When(x => x.Entity == "RESULT", () => { - RuleFor(x => x.ResultActionId) + RuleFor(x => x.Result.ActionId) .NotNull() .WithMessage("RESULT requires ResultActionId (maps to @pRESULT_ACTION_ID)."); - RuleFor(x => x.ResultStatusId) + RuleFor(x => x.Result.StatusId) .NotNull() .WithMessage("RESULT requires ResultStatusId (maps to @pRESULT_STATUS_ID)."); }); @@ -66,7 +66,7 @@ public class InsertObjectProcedureValidator : AbstractValidator x.Entity == "ENDPOINT_PARAMS", () => { - RuleFor(x => x.EndpointParamsGroupId) + RuleFor(x => x.EndpointParams.GroupId) .NotNull() .WithMessage("ENDPOINT_PARAMS requires EndpointParamsGroupId (maps to @pENDPOINT_PARAMS_GROUP_ID)."); }); @@ -76,12 +76,12 @@ public class InsertObjectProcedureValidator : AbstractValidator x.AddedWho != null); - RuleFor(x => x.EndpointDescription) + RuleFor(x => x.Endpoint.Description) .MaximumLength(250) - .When(x => x.EndpointDescription != null); + .When(x => x.Endpoint.Description != null); - RuleFor(x => x.EndpointAuthDescription) + RuleFor(x => x.EndpointAuth.Description) .MaximumLength(250) - .When(x => x.EndpointAuthDescription != null); + .When(x => x.EndpointAuth.Description != null); } } \ No newline at end of file