backbone-catalog 0.7.0

Canonical product/service identity: Item, Item Group, UOM (Indonesia-first)
Documentation
//! Repository for UomConversion entities
//!
//! Originally generated by metaphor-schema; now **user-owned** — this exact path is declared under
//! `user_owned` in `metaphor.codegen.yaml`, so the generator skips it wholesale.
//!
//! Thin newtype over `backbone_orm::GenericCrudRepository<UomConversion, backbone_orm::SoftDelete>`.
//! All standard CRUD methods are available via `Deref`.
//!
//! Role after the ADR-0023 rewrite: unit conversion is carried by the UoM parent-store tree
//! (`uom_repository.rs` + `domain::services::uom_tree`), NOT by pairwise rows here. The table and
//! its read surface remain for legacy data and a future item-specific conversion layer; the
//! validated write path no longer inserts conversion rows, and nothing resolves conversion
//! factors from this table.

use crate::domain::entity::UomConversion;

/// Table name for UomConversion entities
pub const TABLE_NAME: &str = "catalog.uom_conversions";

/// Repository for UomConversion entities.
///
/// All standard CRUD, soft-delete, pagination, and bulk methods are
/// provided automatically via `Deref` to `backbone_orm::GenericCrudRepository`.
pub struct UomConversionRepository(
    backbone_orm::GenericCrudRepository<UomConversion, backbone_orm::SoftDelete>,
);

impl std::ops::Deref for UomConversionRepository {
    type Target = backbone_orm::GenericCrudRepository<UomConversion, backbone_orm::SoftDelete>;
    fn deref(&self) -> &Self::Target { &self.0 }
}

impl UomConversionRepository {
    /// Create a new repository instance.
    pub fn new(pool: sqlx::PgPool) -> Self {
        Self(backbone_orm::GenericCrudRepository::new(pool, TABLE_NAME))
    }
}

backbone_core::impl_crud_repository!(UomConversionRepository, UomConversion, soft_delete);