backbone-inventory 0.9.29

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

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

/// Validator type alias for StockLedgerEntry entities.
pub type StockLedgerEntryValidator = EntityValidator<StockLedgerEntry>;

/// Build a validator for StockLedgerEntry with all schema-defined field rules.
pub fn stock_ledger_entry_validator() -> StockLedgerEntryValidator {
    EntityValidator::new()
        .rule(RequiredString::new("voucher_no", |e: &StockLedgerEntry| &e.voucher_no))
    // <<< CUSTOM RULES
    // END CUSTOM RULES
}

// <<< CUSTOM
// END CUSTOM