pub struct InventoryReadService { /* private fields */ }Expand description
Read-only queries over inventory balances (the consumer-facing read port).
This service only projects — the SQL lives in BinRepository, per the module’s 4-layer rule.
Implementations§
Source§impl InventoryReadService
impl InventoryReadService
pub fn new(db_pool: PgPool) -> Self
Sourcepub async fn availability(
&self,
item_id: Uuid,
warehouse_id: Uuid,
) -> Result<AvailabilityView, Error>
pub async fn availability( &self, item_id: Uuid, warehouse_id: Uuid, ) -> Result<AvailabilityView, Error>
Availability for one item in one warehouse. Returns a zeroed view (available 0) when no bin exists yet — an un-received item is simply unavailable, not an error.
Sourcepub async fn availability_across_warehouses(
&self,
item_id: Uuid,
) -> Result<Vec<AvailabilityView>, Error>
pub async fn availability_across_warehouses( &self, item_id: Uuid, ) -> Result<Vec<AvailabilityView>, Error>
Availability for one item across every warehouse that holds a bin for it.
Sourcepub async fn stock_balance(
&self,
item_id: Uuid,
warehouse_id: Uuid,
) -> Result<Option<StockBalance>, Error>
pub async fn stock_balance( &self, item_id: Uuid, warehouse_id: Uuid, ) -> Result<Option<StockBalance>, Error>
Valuation balance for one item in one warehouse (None if no bin exists).
Sourcepub async fn quant_availability(
&self,
item_id: Uuid,
location_id: Uuid,
) -> Result<QuantAvailability, Error>
pub async fn quant_availability( &self, item_id: Uuid, location_id: Uuid, ) -> Result<QuantAvailability, Error>
Quant-grain availability at one location: available = quantity − reserved over the
location’s quant rows (T2 — the READ arm of the reservation triangle; the warehouse-grain
Self::availability above projects the same invariant off the Bin balance). Zeroed view
when no quant exists — an unreceived item is unavailable, not an error.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for InventoryReadService
impl !UnwindSafe for InventoryReadService
impl Freeze for InventoryReadService
impl Send for InventoryReadService
impl Sync for InventoryReadService
impl Unpin for InventoryReadService
impl UnsafeUnpin for InventoryReadService
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more