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¶
CurrentUserIdmust not be empty (BR-AV-01).- On failure: adds a validation error for
CurrentUserId. CallRecordingmust not be empty/null (BR-AV-02).- On failure: adds a validation error for
CallRecording. ClaimIdmust not be empty (BR-AV-03).- On failure: adds a validation error with message "Error: A claim number is required."
- If
RecordingSystem == RecordingSystemTypes.Fraud,InvestigationIdmust not be empty (BR-AV-04). - On failure: adds a validation error with message "Error: A case number is required."
- If
RecordingSystem != RecordingSystemTypes.Fraud: this rule is skipped entirely. - The combined description+notes text (
CallRecordingExtensions.GetDescription(CallRecording)) must be ≤ 100 characters (BR-AV-05). GetDescriptionitself applies BR-AV-10 to compute the text being measured.- On failure: adds a validation error whose message text states "less than 80 characters" — a documented inconsistency with the actual 100-character enforced limit.
FluentValidationaggregates all rule results into a singleValidationResultand returns it to the caller (AudioVideoService.ImportRecording), which wraps any failures in aSaifValidationException.
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.ImportRecordingthrows oneSaifValidationExceptionwrapping 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.
Related documentation¶
Sources¶
Application\SAIF.Application.Services.AudioVideo\Services\Utilities\AudioVideo\AudioVideoValidator.csApplication\SAIF.Application.Services.AudioVideo\Services\Utilities\AudioVideo\CallRecordingExtensions.cs