pub struct UnitOwner {
pub id: Uuid,
pub unit_id: Uuid,
pub owner_id: Uuid,
pub ownership_percentage: f64,
pub start_date: DateTime<Utc>,
pub end_date: Option<DateTime<Utc>>,
pub is_primary_contact: bool,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
UnitOwner represents the ownership relationship between a Unit and an Owner This entity supports:
- Multiple owners per unit (co-ownership, indivision)
- Multiple units per owner (owner in multiple buildings)
- Ownership percentage tracking
- Historical ownership tracking (start_date, end_date)
Fields§
§id: Uuid§unit_id: Uuid§owner_id: Uuid§ownership_percentage: f64Ownership percentage (0.0 to 1.0) Example: 0.5 = 50%, 1.0 = 100%
start_date: DateTime<Utc>Date when ownership started
end_date: Option<DateTime<Utc>>Date when ownership ended (None = current owner)
is_primary_contact: boolIs this owner the primary contact for this unit?
created_at: DateTime<Utc>§updated_at: DateTime<Utc>Implementations§
Source§impl UnitOwner
impl UnitOwner
Sourcepub fn new(
unit_id: Uuid,
owner_id: Uuid,
ownership_percentage: f64,
is_primary_contact: bool,
) -> Result<Self, String>
pub fn new( unit_id: Uuid, owner_id: Uuid, ownership_percentage: f64, is_primary_contact: bool, ) -> Result<Self, String>
Create a new UnitOwner relationship
Sourcepub fn new_with_start_date(
unit_id: Uuid,
owner_id: Uuid,
ownership_percentage: f64,
is_primary_contact: bool,
start_date: DateTime<Utc>,
) -> Result<Self, String>
pub fn new_with_start_date( unit_id: Uuid, owner_id: Uuid, ownership_percentage: f64, is_primary_contact: bool, start_date: DateTime<Utc>, ) -> Result<Self, String>
Create a new UnitOwner with a specific start date
Sourcepub fn end_ownership(&mut self, end_date: DateTime<Utc>) -> Result<(), String>
pub fn end_ownership(&mut self, end_date: DateTime<Utc>) -> Result<(), String>
End this ownership relationship
Sourcepub fn update_percentage(&mut self, new_percentage: f64) -> Result<(), String>
pub fn update_percentage(&mut self, new_percentage: f64) -> Result<(), String>
Update ownership percentage
Sourcepub fn set_primary_contact(&mut self, is_primary: bool)
pub fn set_primary_contact(&mut self, is_primary: bool)
Set as primary contact
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UnitOwner
impl RefUnwindSafe for UnitOwner
impl Send for UnitOwner
impl Sync for UnitOwner
impl Unpin for UnitOwner
impl UnwindSafe for UnitOwner
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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.