ResourceManagement
                                
                                 ResourceManagement copied to clipboard
                                
                                    ResourceManagement copied to clipboard
                            
                            
                            
                        Need validation on Domain objects
We need to add validation to the objects in Fritz.ResourceManagement.Domain similar to the implementation of ScheduleItem
Hi you can assign me this issue
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
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
 
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.
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.
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.