From 95046e403a517ee628cb7617d40f96a11c01e818 Mon Sep 17 00:00:00 2001 From: samgibsonmoj Date: Tue, 20 Aug 2024 10:22:21 +0100 Subject: [PATCH] Set fixed length for external identifier validation --- .../Queries/Search/CandidateSearchQueryValidator.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Application/Features/Candidates/Queries/Search/CandidateSearchQueryValidator.cs b/src/Application/Features/Candidates/Queries/Search/CandidateSearchQueryValidator.cs index b37e9d96..618acd33 100644 --- a/src/Application/Features/Candidates/Queries/Search/CandidateSearchQueryValidator.cs +++ b/src/Application/Features/Candidates/Queries/Search/CandidateSearchQueryValidator.cs @@ -28,10 +28,11 @@ public CandidateSearchQueryValidator() RuleFor(q => q.ExternalIdentifier) .NotEmpty() - .NotNull() .WithMessage("External identifier is required") .Matches(ValidationConstants.AlphaNumeric) - .WithMessage(string.Format(ValidationConstants.AlphaNumericMessage, "External Identifier")); + .WithMessage(string.Format(ValidationConstants.AlphaNumericMessage, "External Identifier")) + .Length(7) // CRN and NOMIS Number (both 7 chars) + .WithMessage("Unrecognised format for External Identifier"); } } \ No newline at end of file