backbone-bucket 0.2.0

Bucket Bounded Context: File Storage Module for Backbone Framework
Documentation
//! Validator for ProcessingJob entity
//!
//! Generated by metaphor-schema. Do not edit manually.
//!
//! Returns an `EntityValidator<ProcessingJob>` pre-loaded with schema-derived
//! field rules. Extend in the `// <<< CUSTOM` zone.

use backbone_core::{EntityValidator, ValidationErrors, ValidationError};
use backbone_core::{NonNegative, OptionalNotBlank};
use crate::domain::entity::ProcessingJob;

/// Validator type alias for ProcessingJob entities.
pub type ProcessingJobValidator = EntityValidator<ProcessingJob>;

/// Build a validator for ProcessingJob with all schema-defined field rules.
pub fn processing_job_validator() -> ProcessingJobValidator {
    EntityValidator::new()
        .rule(OptionalNotBlank::new("error_message", |e: &ProcessingJob| e.error_message.as_deref()))
        .rule(NonNegative::new("retry_count", |e: &ProcessingJob| e.retry_count as i64))
    // <<< CUSTOM RULES
    // hook rule: file_must_exist (implement in CUSTOM zone)
    // hook rule: file_must_be_accessible (implement in CUSTOM zone)
    // hook rule: valid_job_type (implement in CUSTOM zone)
    // hook rule: job_type_must_match_file (implement in CUSTOM zone)
    // hook rule: no_duplicate_pending_job (implement in CUSTOM zone)
    // hook rule: priority_valid (implement in CUSTOM zone)
    // hook rule: cannot_modify_completed (implement in CUSTOM zone)
    // END CUSTOM RULES
}

// <<< CUSTOM
// END CUSTOM