LegalTaskValidator¶
FluentValidation validator for LegalTask that extends the shared TaskValidator<LegalTask> base with legal-activity-specific rules: valid claim number (via ILegalTaskService.IsValidClaim), valid/authorized assigned user or group (via ILegalTaskService.CanUserEdit and ValidGroups), a task date within an allowed range (adjusted for the work calendar), a required case ID for legal-category tasks, and a required note category for legal-category tasks.
Purpose¶
- Rejects a task whose claim number does not resolve to a valid claim.
- Rejects a task assigned to a user (not a valid group) who is not authorized to edit it, unless the assignee is the reserved "additional info" task user.
- Rejects a task date that is not within the work-calendar-adjusted range from today through two years in the future, when the date has actually changed and the task is not an "additional info" task.
- Requires a case ID for tasks in the Legal (
LGLT) category. - Requires a legal note category for tasks in the Legal (
LGLT) category, unless the assignee is the "additional info" task user.
Context¶
- Namespace:
SAIF.Services.Legal.Tasks - Assembly/package:
SAIF.Services(packaged inside theSAIF.SAIFCode.CoreNuGet package).
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| LegalTaskValidator (constructor) | public LegalTaskValidator(ILegalTaskService taskService, IWorkCalendarService workCalendarService) |
Passes the work-calendar service to the base TaskValidator<LegalTask> constructor and configures the claim-number, task-user, task-date, case-ID, and note-category FluentValidation rules using the injected ILegalTaskService. |
Behavioral notes¶
- The
TaskUserrule only applies (.When(...)) when the user is not the "additional info" (INFO) task user and is not a recognized group (fromILegalTaskService.ValidGroups), i.e., group-assigned and "additional info" tasks bypass the per-user authorization check. - The
TaskDaterule only applies when the date differs fromPreviousTaskDate, so re-saving an unchanged date does not re-trigger the range check. - The
CaseIdandLegalNoteCategoryrules only apply whenTaskCategory.Codeequals the Legal activity category (LGLT); non-legal tasks are exempt from both.
Constraints and usage notes¶
- Carries a
CA1710:IdentifiersShouldHaveCorrectSuffixsuppression, since FluentValidation's naming convention ("Validator") does not match theIValidatorinterface-suffix rule.* - Depends on
ILegalTaskService.IsValidClaim,CanUserEdit,AdjustTaskDate, andValidGroupsat validation time, coupling this validator to a fully constructed task service rather than pure data rules.*
Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.
Sources¶
Services/SAIF.Services/Legal/Tasks/LegalTaskValidator.cs