pub struct UnitOwnerUseCases { /* private fields */ }Implementations§
Source§impl UnitOwnerUseCases
impl UnitOwnerUseCases
pub fn new( unit_owner_repository: Arc<dyn UnitOwnerRepository>, unit_repository: Arc<dyn UnitRepository>, owner_repository: Arc<dyn OwnerRepository>, ) -> Self
Sourcepub async fn add_owner_to_unit(
&self,
unit_id: Uuid,
owner_id: Uuid,
ownership_percentage: Decimal,
is_primary_contact: bool,
) -> Result<UnitOwner, String>
pub async fn add_owner_to_unit( &self, unit_id: Uuid, owner_id: Uuid, ownership_percentage: Decimal, is_primary_contact: bool, ) -> Result<UnitOwner, String>
Add an owner to a unit with specified ownership percentage
Sourcepub async fn remove_owner_from_unit(
&self,
unit_id: Uuid,
owner_id: Uuid,
) -> Result<UnitOwner, String>
pub async fn remove_owner_from_unit( &self, unit_id: Uuid, owner_id: Uuid, ) -> Result<UnitOwner, String>
Remove an owner from a unit (sets end_date to now)
Sourcepub async fn update_ownership_percentage(
&self,
unit_owner_id: Uuid,
new_percentage: Decimal,
) -> Result<UnitOwner, String>
pub async fn update_ownership_percentage( &self, unit_owner_id: Uuid, new_percentage: Decimal, ) -> Result<UnitOwner, String>
Update the ownership percentage for a unit-owner relationship
Sourcepub async fn transfer_ownership(
&self,
from_owner_id: Uuid,
to_owner_id: Uuid,
unit_id: Uuid,
) -> Result<(UnitOwner, UnitOwner), String>
pub async fn transfer_ownership( &self, from_owner_id: Uuid, to_owner_id: Uuid, unit_id: Uuid, ) -> Result<(UnitOwner, UnitOwner), String>
Transfer ownership from one owner to another
Sourcepub async fn get_unit_owners(
&self,
unit_id: Uuid,
) -> Result<Vec<UnitOwner>, String>
pub async fn get_unit_owners( &self, unit_id: Uuid, ) -> Result<Vec<UnitOwner>, String>
Get all current owners of a unit
Sourcepub async fn get_owner_units(
&self,
owner_id: Uuid,
) -> Result<Vec<UnitOwner>, String>
pub async fn get_owner_units( &self, owner_id: Uuid, ) -> Result<Vec<UnitOwner>, String>
Get all current units owned by an owner
Sourcepub async fn get_unit_ownership_history(
&self,
unit_id: Uuid,
) -> Result<Vec<UnitOwner>, String>
pub async fn get_unit_ownership_history( &self, unit_id: Uuid, ) -> Result<Vec<UnitOwner>, String>
Get ownership history for a unit (including past owners)
Sourcepub async fn get_owner_ownership_history(
&self,
owner_id: Uuid,
) -> Result<Vec<UnitOwner>, String>
pub async fn get_owner_ownership_history( &self, owner_id: Uuid, ) -> Result<Vec<UnitOwner>, String>
Get ownership history for an owner (including past units)
Sourcepub async fn set_primary_contact(
&self,
unit_owner_id: Uuid,
) -> Result<UnitOwner, String>
pub async fn set_primary_contact( &self, unit_owner_id: Uuid, ) -> Result<UnitOwner, String>
Set a unit-owner relationship as primary contact
Sourcepub async fn get_unit_owner(
&self,
id: Uuid,
) -> Result<Option<UnitOwner>, String>
pub async fn get_unit_owner( &self, id: Uuid, ) -> Result<Option<UnitOwner>, String>
Get a specific unit-owner relationship by ID
Sourcepub async fn has_active_owners(&self, unit_id: Uuid) -> Result<bool, String>
pub async fn has_active_owners(&self, unit_id: Uuid) -> Result<bool, String>
Check if a unit has any active owners
Sourcepub async fn get_total_ownership_percentage(
&self,
unit_id: Uuid,
) -> Result<Decimal, String>
pub async fn get_total_ownership_percentage( &self, unit_id: Uuid, ) -> Result<Decimal, String>
Get the total ownership percentage for a unit
Sourcepub async fn designate_voting_representative(
&self,
unit_id: Uuid,
owner_id: Uuid,
) -> Result<UnitOwner, AppError>
pub async fn designate_voting_representative( &self, unit_id: Uuid, owner_id: Uuid, ) -> Result<UnitOwner, AppError>
Désigne owner_id comme représentant de vote unique du lot unit_id
(Art. 3.87 §1 CC, #848). Un lot à plusieurs titulaires actifs (couple,
succession — le cas le plus ordinaire) voit son vote SUSPENDU tant
qu’aucun d’eux n’est désigné ; cette méthode livre la désignation qui
lève cette suspension (voting_right_status redevient Active).
Idempotent : redésigner le représentant déjà en place est un no-op, pas une seconde désignation.
Refuse (AppError::Conflict, via VotingRightError::MultipleRepresentatives)
si un AUTRE titulaire du lot est déjà désigné : l’Art. 3.87 §1 prévoit
un représentant UNIQUE. C’est le contrôle dormant nommé par #848 —
assert_single_voting_representative — appelé ici pour la première
fois en production, sur l’état PROSPECTIF (les titulaires actuels plus
la désignation qui vient), avant toute écriture.
Auto Trait Implementations§
impl !RefUnwindSafe for UnitOwnerUseCases
impl !UnwindSafe for UnitOwnerUseCases
impl Freeze for UnitOwnerUseCases
impl Send for UnitOwnerUseCases
impl Sync for UnitOwnerUseCases
impl Unpin for UnitOwnerUseCases
impl UnsafeUnpin for UnitOwnerUseCases
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
§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>
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