Skip to content

Validate import request

AudioVideoValidator is a FluentValidation.AbstractValidator<ImportAudioRequest> invoked synchronously at the start of Import call recording, isolating input-validation rules from orchestration logic.

Field Value
Operation ID OP-AV-VALIDATE-REQUEST
Trigger ImportAudioRequest instance passed to AudioVideoValidator.Validate
Inputs ImportAudioRequest (CurrentUserId, CallRecording, ClaimId, InvestigationId, RecordingSystem)
Outputs FluentValidation.Results.ValidationResult with IsValid/Errors, consumed by the caller to build a SaifValidationException
Primary components AudioVideoValidator
Entry point Application\SAIF.Application.Services.AudioVideo\Services\Utilities\AudioVideo\AudioVideoValidator.cs

Steps

  1. CurrentUserId must not be empty (BR-AV-01).
  2. On failure: adds a validation error for CurrentUserId.
  3. CallRecording must not be empty/null (BR-AV-02).
  4. On failure: adds a validation error for CallRecording.
  5. ClaimId must not be empty (BR-AV-03).
  6. On failure: adds a validation error with message "Error: A claim number is required."
  7. If RecordingSystem == RecordingSystemTypes.Fraud, InvestigationId must not be empty (BR-AV-04).
  8. On failure: adds a validation error with message "Error: A case number is required."
  9. If RecordingSystem != RecordingSystemTypes.Fraud: this rule is skipped entirely.
  10. The combined description+notes text (CallRecordingExtensions.GetDescription(CallRecording)) must be ≤ 100 characters (BR-AV-05).
  11. GetDescription itself applies BR-AV-10 to compute the text being measured.
  12. On failure: adds a validation error whose message text states "less than 80 characters" — a documented inconsistency with the actual 100-character enforced limit.
  13. FluentValidation aggregates all rule results into a single ValidationResult and returns it to the caller (AudioVideoService.ImportRecording), which wraps any failures in a SaifValidationException.

Process flow

The following diagram visualizes this operation's control flow.

flowchart TD
    Start([Validate called]) --> S1{CurrentUserId empty?}
    S1 -->|Yes| Err1[Add error]
    S1 -->|No| S2{CallRecording empty?}
    S2 -->|Yes| Err2[Add error]
    S2 -->|No| S3{ClaimId empty?}
    S3 -->|Yes| Err3[Add error]
    S3 -->|No| S4{RecordingSystem = Fraud and InvestigationId empty?}
    S4 -->|Yes| Err4[Add error]
    S4 -->|No| S5{Description length > 100?}
    S5 -->|Yes| Err5[Add error]
    S5 -->|No| Ok([All rules pass])
    Err1 --> Result([Return ValidationResult])
    Err2 --> Result
    Err3 --> Result
    Err4 --> Result
    Err5 --> Result
    Ok --> Result

Failure and edge-case behavior

  • Multiple rule failures are aggregated into a single ValidationResult; AudioVideoService.ImportRecording throws one SaifValidationException wrapping all of them, not one exception per rule.
  • The description-length rule message states 80 characters while the code enforces 100 (BR-AV-05) — callers relying on the message text to determine the actual limit will be misled.

Sources

  • Application\SAIF.Application.Services.AudioVideo\Services\Utilities\AudioVideo\AudioVideoValidator.cs
  • Application\SAIF.Application.Services.AudioVideo\Services\Utilities\AudioVideo\CallRecordingExtensions.cs