Skip to content

Applied new [ValidateLaCode] attribute to actions and controllers that consume code #2339

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 13, 2025

Conversation

WolfyUK
Copy link
Collaborator

@WolfyUK WolfyUK commented May 7, 2025

Context

AB#254608 AB#260043 #2337

Change proposed in this pull request

  • Implemented action filter above for LA codeand applied to controllers/actions
  • Updated integration tests to ensure all dummy LA codes are of correct format
  • Refactored earlier implementation to instead make use of IValidator

Guidance to review

Dependency on #2337.
Any URL including a bad LA code should fail with 404 and the 'page not found' view. E2E/A11y should be unaffected.

Checklist (add/remove as appropriate)

  • Work items have been linked (use AB#)
  • Your code builds clean without any errors or warnings
  • You have run all unit/integration tests and they pass
  • Your branch has been rebased onto main
  • You have tested by running locally
  • You have reviewed with UX/Design

@WolfyUK WolfyUK force-pushed the tech-debt/258443/260043-la-code-filter branch from 3fb4bcd to cd8d248 Compare May 7, 2025 12:55
@WolfyUK WolfyUK force-pushed the tech-debt/258443/260043-la-code-filter branch 2 times, most recently from 1f8e820 to 853e9f2 Compare May 8, 2025 09:19
@WolfyUK WolfyUK marked this pull request as ready for review May 8, 2025 09:20
@WolfyUK WolfyUK marked this pull request as draft May 8, 2025 11:07
@WolfyUK WolfyUK marked this pull request as ready for review May 12, 2025 05:10
@WolfyUK WolfyUK marked this pull request as draft May 12, 2025 10:38
@WolfyUK WolfyUK force-pushed the tech-debt/258443/260043-la-code-filter branch from 853e9f2 to a12d2a9 Compare May 12, 2025 14:59
@WolfyUK WolfyUK marked this pull request as ready for review May 12, 2025 15:00
@WolfyUK WolfyUK force-pushed the tech-debt/258443/260043-la-code-filter branch from a12d2a9 to a041d34 Compare May 12, 2025 15:04
@WolfyUK WolfyUK force-pushed the tech-debt/258443/260043-la-code-filter branch from a041d34 to f757c8c Compare May 12, 2025 15:20
RuleFor(p => p.Value)
.Length(6)
.When(p => p.Type == OrganisationTypes.School)
.When(p => p.ValueAsInt != null)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would -19823 pass this validation as is? Length 6 and is a valid int?

Could use .Must(p=> p.All(char.IsDigit))?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot! Updated

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about XXXXXX? Does that pass or fail the validation?

My gut is saying that'll pass based on the 'when'. However I've not used when before so not 100% sure on the behaviour.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One of the other rules fails validation with Organisation identifier must be a number for XXXXXX

@WolfyUK WolfyUK merged commit b474c2f into main May 13, 2025
16 checks passed
@WolfyUK WolfyUK deleted the tech-debt/258443/260043-la-code-filter branch May 13, 2025 09:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants