Skip to content
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

Induction edit start date #1779

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open

Induction edit start date #1779

wants to merge 16 commits into from

Conversation

CathLass
Copy link
Contributor

@CathLass CathLass commented Dec 31, 2024

if (StartDate < new DateOnly(1999, 5, 7)) // CML TODO - business logic - move
{
ModelState.AddModelError(nameof(StartDate), "The induction start date cannot be before 7th May 1999");
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Validation logic to be added to person ? Not sure I can add it to the ValidateInductionData method because that's being used for updating the cpd induction data which I guess might have dates prior to 7th may 1999?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We could put a staticDateOnly EarliestInductionStartDate on Person; we don't have a great way of sharing validation logic with Razor Pages currently.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done - I might get in trouble for this though because that error string is supposed to say 7th May not 7 May. I propose to deal with that if it's mentioned and not before

The method ValidateInductionData - is that intended to be only for the API? I know this FE is updating the DB directly but I expect I'll call a validate method before I update the record from the last page of the wizard.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We have UiDefaults.DateOnlyDisplayFormat to use for date formatting.

method ValidateInductionData - is that intended to be only for the API?
Yes, we don't have a way of easily sharing validation logic across the API and the front-end currently.

@CathLass CathLass marked this pull request as ready for review January 2, 2025 12:26
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.

2 participants