ClaimTaskValidator¶
A FluentValidation validator for ClaimTask that extends the shared TaskValidator<ClaimTask> base rule set (due date and text) with claim-task-specific rules: the claim number must reference an existing claim, the assigned task user must be a valid/authorized mail ID unless it is the special "INFO" user or a configured task group, and the task date must fall within the next two years when it has changed and the user is not "INFO". It depends on ITaskService (to check claim validity and user edit authorization) and IWorkCalendarService (passed through to the base validator).
Purpose¶
- Confirms
ClaimNumbercorresponds to a real claim viaITaskService.IsValidClaim. - Confirms the assigned
TaskUsermail ID is valid/authorized viaITaskService.CanUserEdit, except for the reserved "INFO" user or task-group IDs listed inITaskService.ValidGroups. - Confirms
TaskDateis between today and two years from today, but only enforces this when the date has actually changed fromPreviousTaskDateand the user is not "INFO".
Context¶
- Namespace:
SAIF.Services.Claims.Tasks - Assembly/package:
SAIF.Services(packaged inside theSAIF.SAIFCode.CoreNuGet package)
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| ClaimTaskValidator(ITaskService, IWorkCalendarService) | public ClaimTaskValidator(ITaskService taskService, IWorkCalendarService workCalendarService) |
Passes workCalendarService to the base TaskValidator<ClaimTask> constructor, then registers claim-number validity, task-user authorization (skipped for "INFO" and configured groups), and task-date range rules using taskService. |
Behavioral notes¶
- The
TaskUserauthorization rule is conditioned with two.When(...)clauses: it only runs when the user is not the literal string"INFO"and is not one of the configured task-group identifiers exposed byITaskService.ValidGroups. - The task-date range rule only fires when
TaskDate != PreviousTaskDate, so re-saving a task without changing its date does not re-trigger the two-year-window check. - Extends
SAIF.Services.Tasks.TaskValidator<ClaimTask>(same library), which additionally requiresTaskDateto be set and fall on a valid working day perIWorkCalendarService.IsWorkingDay, and requiresTaskTextto be non-null, non-empty, and no more than 4000 characters; those base rules apply to everyClaimTaskvalidated by this class in addition to the rules registered here.
Sources¶
- Services/SAIF.Services/Claims/Tasks/ClaimTaskValidator.cs