Skip to content

ImageEditValidator

A FluentValidation AbstractValidator<ImageEdit> used to validate agency-image edits before they are applied by SAIF.Services.Agencies.Imaging.ImageService.EditImage. It has no injected dependencies, referencing ImageService.MaxDescriptionLength directly as a static constant.

Purpose

  • Enforces a maximum description length matching ImageService.MaxDescriptionLength (256 characters).
  • Requires a category code and a document-type code on every agency-image edit.

Context

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

Public members

Member Signature Purpose
ImageEditValidator() public ImageEditValidator() Registers RuleFor(n => n.Text).Length(0, ImageService.MaxDescriptionLength), RuleFor(n => n.CategoryCode).NotNull(), and RuleFor(n => n.DocumentTypeCode).NotNull(), each with a corresponding "Error: ..." message.

Behavioral notes

  • Unlike the group-imaging ImageEditValidator, this validator does not check user-edit authorization or verify the image/category/type/group exist in the repository — those checks are performed inline within ImageService.EditImage itself rather than in this validator*.

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/Agencies/Imaging/Validators/ImageEditValidator.cs