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

Need validation on Domain objects #8

Open
csharpfritz opened this issue Jun 16, 2019 · 6 comments
Open

Need validation on Domain objects #8

csharpfritz opened this issue Jun 16, 2019 · 6 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@csharpfritz
Copy link
Contributor

We need to add validation to the objects in Fritz.ResourceManagement.Domain similar to the implementation of ScheduleItem

@csharpfritz csharpfritz added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels Jun 16, 2019
@marblekirby
Copy link
Contributor

Hi you can assign me this issue

@marblekirby
Copy link
Contributor

Do we have a list of validation rules anywhere? Such as names (GivenName, SurName) have a min length, phone numbers should be valid for a certain country? Thanks

marblekirby added a commit to marblekirby/ResourceManagement that referenced this issue Jul 13, 2019
marblekirby added a commit to marblekirby/ResourceManagement that referenced this issue Jul 13, 2019
@csharpfritz
Copy link
Contributor Author

Some initial rules that we can apply during create and edit operations.

  • Person

    • GivenName and Surname should be required
    • At least one PersonType should be defined
    • Phone number is required
  • ScheduleItem

    • Required fields: Status, Name, StartDateTime, EndDateTime
    • Name max length: 50 characters
    • Minimum duration: 10 minutes
  • ScheduleException

    • Required fields: StartDate, EndDate, Name
    • StartDate must be before EndDate
    • Minimum duration of 1 day
  • RecurringSchedule

    • Required fields: Name, CronPattern, Duration, MinStartDateTime, MaxEndDateTime
    • MinStartDateTime must be before MaxEndDateTime
    • Minimum duration of 30 minutes
    • CronPattern must be a valid CRON pattern

marblekirby added a commit to marblekirby/ResourceManagement that referenced this issue Jul 17, 2019
marblekirby added a commit to marblekirby/ResourceManagement that referenced this issue Jul 17, 2019
@SimonGeering
Copy link
Contributor

If it helps, there is a great library for this sort of validation code I can recommend: https://fluentvalidation.net/
It is net standard code so should work with the tech here, and has a nice API with the advantage of being able to create validation helper e.g email is valid, independent of applying them to multiple business objectives e.g the customer has a valid email address, the staff member has a valid email address. This might help keep things more granular and SRP so more people can collaborate on what looks to be a complex issue at various tech levels.

@marblekirby
Copy link
Contributor

Hi, I am familar with Fluent Validation and used it alot quite recently. I think creating validators for the domain objects would be a better approach, although I was going with the current style of validation that was used in the ScheduleItem. I think implementing Fluent Validation is a good shout.

@hugodahl
Copy link
Contributor

It dawned on me that we probably need to restrict which characters are allowed to be entered in certain fields - for the time being anyway. For example, I doubt that we would legitimately permit emojis in the majority, if not all, identity fields.

csharpfritz pushed a commit that referenced this issue Jul 21, 2019
* issue #8 inital commit

* Issue #8 Cron validation in RecurringSchedule.cs

* more validation rules issue #8

* validation rules for default datetimes issue #8
csharpfritz added a commit that referenced this issue Aug 2, 2019
* Initial schedule UI work

* Revert "Initial schedule UI"

* Fix variable height with DayPicker component by adding an extra row to CSS Grid

* Now passing schedule information around:

* Now passing schedule state between components

* Completed initial UI for scheduleitems

* Now saving recurring schedules

* Started work on the RecurrenceDataEntry component

* Now doing initial calculations of CRON pattern

* Highlight the date clicked in the DayPicker component

* DayView appointments are positioned correctly and DayView appointments outside the time range are not displayed. Also, Add graphical representation for a schedule item that begins before or after the DayView.

* Refactoring DayView so that we can make a ManagerScheduleView

* Fixed schedule item display on the DayView

* Fixed some display issues, corrected expansion of the schedule

* Fixed small bug in top and bottom styles of items in DayView

* Updated DayView to properly show the week grid for Managers

* Fixed overflow issue with items in DayView

* Started work on calculating employee availability

* Now calculating availability

* Finished Resource Availability test

* Issue #8 - domain object validation (#34)

* issue #8 inital commit

* Issue #8 Cron validation in RecurringSchedule.cs

* more validation rules issue #8

* validation rules for default datetimes issue #8

* Issue #35 - Add support for fluent assertions (#39)

* Added FluentAssertions V5.7.0 NuGet package dependency

* Updated WhenExpandingSchedule tests to use FluentAssertions

* Updated WhenExpandingScheduleAcrossMultipleDays tests to use FluentAssertions

* Updated WhenExpandingSchedule tests to use FluentAssertions

* Issue #33 date time extensions, issue #30 (#38)

* Date time extensions issue #33

* xml comments + renames issue #33

* xml comment i missed issue #33

* removing extension methods for comparing Date with Time issue #33

* added authorization for pages where users must be logged in issue #30

* Completed grain calculations for ManagerView

* Updated to 3.0 preview 7

* Completed conversion to Preview 7 and now using sqlite

* Migrating to Client-side Blazor

* Migrating the components to the Client project

* Finishing merge

* Finished migrating components

* #56: Refactored code out of Availability page into AvailabilityViewModel

* #56 Pulled DayView attribute code out into ViewModel

* #56: Refactored code out of DayPicker into DayPickerViewModel

* #56: Pulled DisplayDayOfMonth rendering logic out into ViewModel

* #56 Added missing DI for DayPickerViewModel

* #56: Refactored code out of DayView into DayViewViewModel

* #56 - Refactored code out of ManagerScheduleView into ManagerScheduleViewViewModel

* #56 Standardised naming for Base component overrides on view models

* #56 Resolved error in Blazor markup - CS1660 C# Cannot convert lambda expression to type 'object' because it is not a delegate type

* #56 - Refactored code out of ManagerScheduleView into ManagerScheduleViewViewModel

* #56 - Refactored code out of NavMenu into NavMenuViewModel

* #56 Refactored ViewModel DI into IServiceCollection Extension method.

* WIP

* Marking the TODO unit test as debug only

* Added BlazorStrap and CSS for header and navbar

* Fixed component references so they now render

* Finished security connection

* Enhanced the formatting of the navbar and login components
csharpfritz added a commit that referenced this issue Aug 2, 2019
* Initial schedule UI work

* Revert "Initial schedule UI"

* Issue #8 - domain object validation (#34)

* issue #8 inital commit

* Issue #8 Cron validation in RecurringSchedule.cs

* more validation rules issue #8

* validation rules for default datetimes issue #8

* WIP - Fetching timeslot data from the server
csharpfritz added a commit that referenced this issue Aug 9, 2019
* Initial schedule UI work

* Revert "Initial schedule UI"

* Issue #8 - domain object validation (#34)

* issue #8 inital commit

* Issue #8 Cron validation in RecurringSchedule.cs

* more validation rules issue #8

* validation rules for default datetimes issue #8

* WIP - Fetching timeslot data from the server

* Fixing datetime data entry on the availability page  #63

* WIP - Trying to get timeslots shown

* Migrating the Availability page to CSS grid
csharpfritz added a commit that referenced this issue Aug 11, 2019
* Feature schedule ui (#64)

* Initial schedule UI work

* Revert "Initial schedule UI"

* Fix variable height with DayPicker component by adding an extra row to CSS Grid

* Now passing schedule information around:

* Now passing schedule state between components

* Completed initial UI for scheduleitems

* Now saving recurring schedules

* Started work on the RecurrenceDataEntry component

* Now doing initial calculations of CRON pattern

* Highlight the date clicked in the DayPicker component

* DayView appointments are positioned correctly and DayView appointments outside the time range are not displayed. Also, Add graphical representation for a schedule item that begins before or after the DayView.

* Refactoring DayView so that we can make a ManagerScheduleView

* Fixed schedule item display on the DayView

* Fixed some display issues, corrected expansion of the schedule

* Fixed small bug in top and bottom styles of items in DayView

* Updated DayView to properly show the week grid for Managers

* Fixed overflow issue with items in DayView

* Started work on calculating employee availability

* Now calculating availability

* Finished Resource Availability test

* Issue #8 - domain object validation (#34)

* issue #8 inital commit

* Issue #8 Cron validation in RecurringSchedule.cs

* more validation rules issue #8

* validation rules for default datetimes issue #8

* Issue #35 - Add support for fluent assertions (#39)

* Added FluentAssertions V5.7.0 NuGet package dependency

* Updated WhenExpandingSchedule tests to use FluentAssertions

* Updated WhenExpandingScheduleAcrossMultipleDays tests to use FluentAssertions

* Updated WhenExpandingSchedule tests to use FluentAssertions

* Issue #33 date time extensions, issue #30 (#38)

* Date time extensions issue #33

* xml comments + renames issue #33

* xml comment i missed issue #33

* removing extension methods for comparing Date with Time issue #33

* added authorization for pages where users must be logged in issue #30

* Completed grain calculations for ManagerView

* Updated to 3.0 preview 7

* Completed conversion to Preview 7 and now using sqlite

* Migrating to Client-side Blazor

* Migrating the components to the Client project

* Finishing merge

* Finished migrating components

* #56: Refactored code out of Availability page into AvailabilityViewModel

* #56 Pulled DayView attribute code out into ViewModel

* #56: Refactored code out of DayPicker into DayPickerViewModel

* #56: Pulled DisplayDayOfMonth rendering logic out into ViewModel

* #56 Added missing DI for DayPickerViewModel

* #56: Refactored code out of DayView into DayViewViewModel

* #56 - Refactored code out of ManagerScheduleView into ManagerScheduleViewViewModel

* #56 Standardised naming for Base component overrides on view models

* #56 Resolved error in Blazor markup - CS1660 C# Cannot convert lambda expression to type 'object' because it is not a delegate type

* #56 - Refactored code out of ManagerScheduleView into ManagerScheduleViewViewModel

* #56 - Refactored code out of NavMenu into NavMenuViewModel

* #56 Refactored ViewModel DI into IServiceCollection Extension method.

* WIP

* Marking the TODO unit test as debug only

* Added BlazorStrap and CSS for header and navbar

* Fixed component references so they now render

* Finished security connection

* Enhanced the formatting of the navbar and login components

* WIP - Fetching timeslot data from the server

* Started work on Timeslot data loading into the availability compo… (#66)

* Initial schedule UI work

* Revert "Initial schedule UI"

* Issue #8 - domain object validation (#34)

* issue #8 inital commit

* Issue #8 Cron validation in RecurringSchedule.cs

* more validation rules issue #8

* validation rules for default datetimes issue #8

* WIP - Fetching timeslot data from the server

* Added restoreDb command

* Refactored navbar and removed BlazorStrap (#67)

* Fixing datetime data entry on the availability page  #63

* WIP - Trying to get timeslots shown

* Migrating the Availability page to CSS grid

* CSS updates and data entry fixes (#68)

* Initial schedule UI work

* Revert "Initial schedule UI"

* Issue #8 - domain object validation (#34)

* issue #8 inital commit

* Issue #8 Cron validation in RecurringSchedule.cs

* more validation rules issue #8

* validation rules for default datetimes issue #8

* WIP - Fetching timeslot data from the server

* Fixing datetime data entry on the availability page  #63

* WIP - Trying to get timeslots shown

* Migrating the Availability page to CSS grid

* Feature: Adding Directory.Build.props (#70)

* Refactor: Restyle Availability Page & Accessibility Improvements (#71)

* refactor: re-styles the availability layout.

* fix: adds main tag to layout

* fix: fixes some a11y issues on availability page.

* refactor: fixes vertical alignment on availability

* Fixed data acquisition #55
csharpfritz added a commit that referenced this issue Aug 11, 2019
* Initial schedule UI work

* Revert "Initial schedule UI"

* Issue #8 - domain object validation (#34)

* issue #8 inital commit

* Issue #8 Cron validation in RecurringSchedule.cs

* more validation rules issue #8

* validation rules for default datetimes issue #8

* WIP - Fetching timeslot data from the server

* Fixing datetime data entry on the availability page  #63

* WIP - Trying to get timeslots shown

* Migrating the Availability page to CSS grid

* Fixed data acquisition #55
csharpfritz added a commit that referenced this issue Aug 16, 2019
* Initial schedule UI work

* Revert "Initial schedule UI"

* Issue #8 - domain object validation (#34)

* issue #8 inital commit

* Issue #8 Cron validation in RecurringSchedule.cs

* more validation rules issue #8

* validation rules for default datetimes issue #8

* Added Azure DevOps status badge

* Fixed Data acquisition #55 (#74)

* Feature schedule ui (#64)

* Initial schedule UI work

* Revert "Initial schedule UI"

* Fix variable height with DayPicker component by adding an extra row to CSS Grid

* Now passing schedule information around:

* Now passing schedule state between components

* Completed initial UI for scheduleitems

* Now saving recurring schedules

* Started work on the RecurrenceDataEntry component

* Now doing initial calculations of CRON pattern

* Highlight the date clicked in the DayPicker component

* DayView appointments are positioned correctly and DayView appointments outside the time range are not displayed. Also, Add graphical representation for a schedule item that begins before or after the DayView.

* Refactoring DayView so that we can make a ManagerScheduleView

* Fixed schedule item display on the DayView

* Fixed some display issues, corrected expansion of the schedule

* Fixed small bug in top and bottom styles of items in DayView

* Updated DayView to properly show the week grid for Managers

* Fixed overflow issue with items in DayView

* Started work on calculating employee availability

* Now calculating availability

* Finished Resource Availability test

* Issue #8 - domain object validation (#34)

* issue #8 inital commit

* Issue #8 Cron validation in RecurringSchedule.cs

* more validation rules issue #8

* validation rules for default datetimes issue #8

* Issue #35 - Add support for fluent assertions (#39)

* Added FluentAssertions V5.7.0 NuGet package dependency

* Updated WhenExpandingSchedule tests to use FluentAssertions

* Updated WhenExpandingScheduleAcrossMultipleDays tests to use FluentAssertions

* Updated WhenExpandingSchedule tests to use FluentAssertions

* Issue #33 date time extensions, issue #30 (#38)

* Date time extensions issue #33

* xml comments + renames issue #33

* xml comment i missed issue #33

* removing extension methods for comparing Date with Time issue #33

* added authorization for pages where users must be logged in issue #30

* Completed grain calculations for ManagerView

* Updated to 3.0 preview 7

* Completed conversion to Preview 7 and now using sqlite

* Migrating to Client-side Blazor

* Migrating the components to the Client project

* Finishing merge

* Finished migrating components

* #56: Refactored code out of Availability page into AvailabilityViewModel

* #56 Pulled DayView attribute code out into ViewModel

* #56: Refactored code out of DayPicker into DayPickerViewModel

* #56: Pulled DisplayDayOfMonth rendering logic out into ViewModel

* #56 Added missing DI for DayPickerViewModel

* #56: Refactored code out of DayView into DayViewViewModel

* #56 - Refactored code out of ManagerScheduleView into ManagerScheduleViewViewModel

* #56 Standardised naming for Base component overrides on view models

* #56 Resolved error in Blazor markup - CS1660 C# Cannot convert lambda expression to type 'object' because it is not a delegate type

* #56 - Refactored code out of ManagerScheduleView into ManagerScheduleViewViewModel

* #56 - Refactored code out of NavMenu into NavMenuViewModel

* #56 Refactored ViewModel DI into IServiceCollection Extension method.

* WIP

* Marking the TODO unit test as debug only

* Added BlazorStrap and CSS for header and navbar

* Fixed component references so they now render

* Finished security connection

* Enhanced the formatting of the navbar and login components

* WIP - Fetching timeslot data from the server

* Started work on Timeslot data loading into the availability compo… (#66)

* Initial schedule UI work

* Revert "Initial schedule UI"

* Issue #8 - domain object validation (#34)

* issue #8 inital commit

* Issue #8 Cron validation in RecurringSchedule.cs

* more validation rules issue #8

* validation rules for default datetimes issue #8

* WIP - Fetching timeslot data from the server

* Added restoreDb command

* Refactored navbar and removed BlazorStrap (#67)

* Fixing datetime data entry on the availability page  #63

* WIP - Trying to get timeslots shown

* Migrating the Availability page to CSS grid

* CSS updates and data entry fixes (#68)

* Initial schedule UI work

* Revert "Initial schedule UI"

* Issue #8 - domain object validation (#34)

* issue #8 inital commit

* Issue #8 Cron validation in RecurringSchedule.cs

* more validation rules issue #8

* validation rules for default datetimes issue #8

* WIP - Fetching timeslot data from the server

* Fixing datetime data entry on the availability page  #63

* WIP - Trying to get timeslots shown

* Migrating the Availability page to CSS grid

* Feature: Adding Directory.Build.props (#70)

* Refactor: Restyle Availability Page & Accessibility Improvements (#71)

* refactor: re-styles the availability layout.

* fix: adds main tag to layout

* fix: fixes some a11y issues on availability page.

* refactor: fixes vertical alignment on availability

* Fixed data acquisition #55

* Revert "Fixed Data acquisition #55" (#75)

This reverts commit 337b80a.

* Updated to Preview 8

Fixed navigation and interactions with the ManagerView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants