Skip to content

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 ClaimNumber corresponds to a real claim via ITaskService.IsValidClaim.
  • Confirms the assigned TaskUser mail ID is valid/authorized via ITaskService.CanUserEdit, except for the reserved "INFO" user or task-group IDs listed in ITaskService.ValidGroups.
  • Confirms TaskDate is between today and two years from today, but only enforces this when the date has actually changed from PreviousTaskDate and the user is not "INFO".

Context

  • Namespace: SAIF.Services.Claims.Tasks
  • Assembly/package: SAIF.Services (packaged inside the SAIF.SAIFCode.Core NuGet 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 TaskUser authorization 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 by ITaskService.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 requires TaskDate to be set and fall on a valid working day per IWorkCalendarService.IsWorkingDay, and requires TaskText to be non-null, non-empty, and no more than 4000 characters; those base rules apply to every ClaimTask validated by this class in addition to the rules registered here.

Sources

  • Services/SAIF.Services/Claims/Tasks/ClaimTaskValidator.cs