backbone-inventory 0.9.29

Inventory: stock ledger of record (SLE) + moving-average valuation; emits COGS/asset AccountingPost (Delivery/Receipt -> GL)
Documentation
//! Validator for DeliveryNote entity
//!
//! Generated by metaphor-schema. Do not edit manually.
//!
//! Returns an `EntityValidator<DeliveryNote>` pre-loaded with schema-derived
//! field rules. Extend in the `// <<< CUSTOM` zone.

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

/// Validator type alias for DeliveryNote entities.
pub type DeliveryNoteValidator = EntityValidator<DeliveryNote>;

/// Build a validator for DeliveryNote with all schema-defined field rules.
pub fn delivery_note_validator() -> DeliveryNoteValidator {
    EntityValidator::new()
        .rule(RequiredString::new("delivery_number", |e: &DeliveryNote| &e.delivery_number))
        .rule(OptionalNotBlank::new("notes", |e: &DeliveryNote| e.notes.as_deref()))
    // <<< CUSTOM RULES
    // END CUSTOM RULES
}

// <<< CUSTOM
// END CUSTOM