backbone_catalog/infrastructure/persistence/uom_conversion_repository.rs
1//! Repository for UomConversion entities
2//!
3//! Originally generated by metaphor-schema; now **user-owned** — this exact path is declared under
4//! `user_owned` in `metaphor.codegen.yaml`, so the generator skips it wholesale.
5//!
6//! Thin newtype over `backbone_orm::GenericCrudRepository<UomConversion, backbone_orm::SoftDelete>`.
7//! All standard CRUD methods are available via `Deref`.
8//!
9//! Role after the ADR-0023 rewrite: unit conversion is carried by the UoM parent-store tree
10//! (`uom_repository.rs` + `domain::services::uom_tree`), NOT by pairwise rows here. The table and
11//! its read surface remain for legacy data and a future item-specific conversion layer; the
12//! validated write path no longer inserts conversion rows, and nothing resolves conversion
13//! factors from this table.
14
15use crate::domain::entity::UomConversion;
16
17/// Table name for UomConversion entities
18pub const TABLE_NAME: &str = "catalog.uom_conversions";
19
20/// Repository for UomConversion entities.
21///
22/// All standard CRUD, soft-delete, pagination, and bulk methods are
23/// provided automatically via `Deref` to `backbone_orm::GenericCrudRepository`.
24pub struct UomConversionRepository(
25 backbone_orm::GenericCrudRepository<UomConversion, backbone_orm::SoftDelete>,
26);
27
28impl std::ops::Deref for UomConversionRepository {
29 type Target = backbone_orm::GenericCrudRepository<UomConversion, backbone_orm::SoftDelete>;
30 fn deref(&self) -> &Self::Target { &self.0 }
31}
32
33impl UomConversionRepository {
34 /// Create a new repository instance.
35 pub fn new(pool: sqlx::PgPool) -> Self {
36 Self(backbone_orm::GenericCrudRepository::new(pool, TABLE_NAME))
37 }
38}
39
40backbone_core::impl_crud_repository!(UomConversionRepository, UomConversion, soft_delete);