pub struct SharedObjectUseCases { /* private fields */ }Implementations§
pub fn new( shared_object_repo: Arc<dyn SharedObjectRepository>, owner_repo: Arc<dyn OwnerRepository>, credit_balance_repo: Arc<dyn OwnerCreditBalanceRepository>, ) -> Self
Get shared object by ID with owner/borrower name enrichment
Sourcepub async fn list_building_objects(
&self,
building_id: Uuid,
) -> Result<Vec<SharedObjectSummaryDto>, String>
pub async fn list_building_objects( &self, building_id: Uuid, ) -> Result<Vec<SharedObjectSummaryDto>, String>
List all shared objects for a building
§Returns
- Objects sorted by available (DESC), object_name (ASC)
Sourcepub async fn list_available_objects(
&self,
building_id: Uuid,
) -> Result<Vec<SharedObjectSummaryDto>, String>
pub async fn list_available_objects( &self, building_id: Uuid, ) -> Result<Vec<SharedObjectSummaryDto>, String>
List available shared objects for a building (marketplace view)
§Returns
- Only available objects (is_available = true)
Sourcepub async fn list_borrowed_objects(
&self,
building_id: Uuid,
) -> Result<Vec<SharedObjectSummaryDto>, String>
pub async fn list_borrowed_objects( &self, building_id: Uuid, ) -> Result<Vec<SharedObjectSummaryDto>, String>
List borrowed shared objects for a building
Sourcepub async fn list_overdue_objects(
&self,
building_id: Uuid,
) -> Result<Vec<SharedObjectSummaryDto>, String>
pub async fn list_overdue_objects( &self, building_id: Uuid, ) -> Result<Vec<SharedObjectSummaryDto>, String>
List overdue shared objects for a building
Sourcepub async fn list_owner_objects(
&self,
owner_id: Uuid,
) -> Result<Vec<SharedObjectSummaryDto>, String>
pub async fn list_owner_objects( &self, owner_id: Uuid, ) -> Result<Vec<SharedObjectSummaryDto>, String>
List all shared objects created by an owner
Sourcepub async fn list_user_borrowed_objects(
&self,
borrower_id: Uuid,
) -> Result<Vec<SharedObjectSummaryDto>, String>
pub async fn list_user_borrowed_objects( &self, borrower_id: Uuid, ) -> Result<Vec<SharedObjectSummaryDto>, String>
List all shared objects currently borrowed by a user
Sourcepub async fn list_objects_by_category(
&self,
building_id: Uuid,
category: SharedObjectCategory,
) -> Result<Vec<SharedObjectSummaryDto>, String>
pub async fn list_objects_by_category( &self, building_id: Uuid, category: SharedObjectCategory, ) -> Result<Vec<SharedObjectSummaryDto>, String>
List shared objects by category (Tools, Books, Electronics, etc.)
Sourcepub async fn list_free_objects(
&self,
building_id: Uuid,
) -> Result<Vec<SharedObjectSummaryDto>, String>
pub async fn list_free_objects( &self, building_id: Uuid, ) -> Result<Vec<SharedObjectSummaryDto>, String>
List free/volunteer shared objects for a building
Update a shared object
§Authorization
- Only owner can update their object
- Cannot update if currently borrowed
Sourcepub async fn mark_object_available(
&self,
object_id: Uuid,
actor_id: Uuid,
) -> Result<SharedObjectResponseDto, String>
pub async fn mark_object_available( &self, object_id: Uuid, actor_id: Uuid, ) -> Result<SharedObjectResponseDto, String>
Sourcepub async fn borrow_object(
&self,
object_id: Uuid,
borrower_id: Uuid,
dto: BorrowObjectDto,
) -> Result<SharedObjectResponseDto, String>
pub async fn borrow_object( &self, object_id: Uuid, borrower_id: Uuid, dto: BorrowObjectDto, ) -> Result<SharedObjectResponseDto, String>
Sourcepub async fn return_object(
&self,
object_id: Uuid,
returner_id: Uuid,
) -> Result<SharedObjectResponseDto, String>
pub async fn return_object( &self, object_id: Uuid, returner_id: Uuid, ) -> Result<SharedObjectResponseDto, String>
Delete a shared object
§Authorization
- Only owner can delete their object
- Cannot delete if currently borrowed
Sourcepub async fn get_object_statistics(
&self,
building_id: Uuid,
) -> Result<SharedObjectStatisticsDto, String>
pub async fn get_object_statistics( &self, building_id: Uuid, ) -> Result<SharedObjectStatisticsDto, String>
Get shared object statistics for a building
Auto Trait Implementations§
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
Mutably borrows from an owned value. Read more
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.