Skip to content

ImageDeleteValidator

A FluentValidation AbstractValidator<ImageDelete> used by SAIF.Services.Groups.Imaging.ImageDeleter (via IValidationService.ValidateAndThrow) to ensure a group image exists before it is deleted. It depends on IGroupImageRepository to check image existence.

Purpose

  • Enforces that the image group referenced by an ImageDelete request actually exists before deletion is permitted.

Context

  • Namespace: SAIF.Services.Groups.Imaging.Validators
  • Assembly/package: SAIF.Services (packaged inside the SAIF.SAIFCode.Core NuGet package)

Public members

Member Signature Purpose
ImageDeleteValidator(groupImageRepository) public ImageDeleteValidator(IGroupImageRepository groupImageRepository) Stores the repository and registers a RuleFor(n => n.ImageGroupId) rule requiring groupImageRepository.ImageFound to return true, with message "Error: Image could not be found."

Behavioral notes

  • Validation is a single existence check; it does not verify edit authorization (that is handled separately by ImageEditValidator/GroupImageSecurityProvider for edits, not deletes)*.

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/Groups/Imaging/Validators/ImageDeleteValidator.cs