pub struct LocalExchange {Show 19 fields
pub id: Uuid,
pub building_id: Uuid,
pub provider_id: Uuid,
pub requester_id: Option<Uuid>,
pub exchange_type: ExchangeType,
pub title: String,
pub description: String,
pub credits: i32,
pub status: ExchangeStatus,
pub offered_at: DateTime<Utc>,
pub requested_at: Option<DateTime<Utc>>,
pub started_at: Option<DateTime<Utc>>,
pub completed_at: Option<DateTime<Utc>>,
pub cancelled_at: Option<DateTime<Utc>>,
pub cancellation_reason: Option<String>,
pub provider_rating: Option<i32>,
pub requester_rating: Option<i32>,
pub created_at: DateTime<Utc>,
pub updated_at: DateTime<Utc>,
}Expand description
Local Exchange Trading System (SEL) - Système d’Échange Local
Enables co-owners to exchange services, objects, and shared purchases using time-based currency (1 hour = 1 credit).
Belgian Legal Context:
- SELs are legal and recognized in Belgium
- No taxation if non-commercial (barter)
- Must not replace professional services (insurance issues)
- Clear T&Cs required (liability disclaimer)
Fields§
§id: Uuid§building_id: Uuid§provider_id: Uuid§requester_id: Option<Uuid>§exchange_type: ExchangeType§title: String§description: String§credits: i32§status: ExchangeStatus§offered_at: DateTime<Utc>§requested_at: Option<DateTime<Utc>>§started_at: Option<DateTime<Utc>>§completed_at: Option<DateTime<Utc>>§cancelled_at: Option<DateTime<Utc>>§cancellation_reason: Option<String>§provider_rating: Option<i32>§requester_rating: Option<i32>§created_at: DateTime<Utc>§updated_at: DateTime<Utc>Implementations§
Source§impl LocalExchange
impl LocalExchange
Sourcepub fn new(
building_id: Uuid,
provider_id: Uuid,
exchange_type: ExchangeType,
title: String,
description: String,
credits: i32,
) -> Result<Self, String>
pub fn new( building_id: Uuid, provider_id: Uuid, exchange_type: ExchangeType, title: String, description: String, credits: i32, ) -> Result<Self, String>
Create a new exchange offer
Sourcepub fn request(&mut self, requester_id: Uuid) -> Result<(), String>
pub fn request(&mut self, requester_id: Uuid) -> Result<(), String>
Request an exchange (transition: Offered → Requested)
Sourcepub fn start(&mut self, actor_id: Uuid) -> Result<(), String>
pub fn start(&mut self, actor_id: Uuid) -> Result<(), String>
Start an exchange (transition: Requested → InProgress)
Sourcepub fn complete(&mut self, actor_id: Uuid) -> Result<(), String>
pub fn complete(&mut self, actor_id: Uuid) -> Result<(), String>
Complete an exchange (transition: InProgress → Completed) Both provider and requester must confirm completion
Sourcepub fn cancel(
&mut self,
actor_id: Uuid,
reason: Option<String>,
) -> Result<(), String>
pub fn cancel( &mut self, actor_id: Uuid, reason: Option<String>, ) -> Result<(), String>
Cancel an exchange
Sourcepub fn rate_provider(
&mut self,
requester_id: Uuid,
rating: i32,
) -> Result<(), String>
pub fn rate_provider( &mut self, requester_id: Uuid, rating: i32, ) -> Result<(), String>
Rate the provider (by requester)
Sourcepub fn rate_requester(
&mut self,
provider_id: Uuid,
rating: i32,
) -> Result<(), String>
pub fn rate_requester( &mut self, provider_id: Uuid, rating: i32, ) -> Result<(), String>
Rate the requester (by provider)
Sourcepub fn has_mutual_ratings(&self) -> bool
pub fn has_mutual_ratings(&self) -> bool
Check if ratings are complete
Trait Implementations§
Source§impl Clone for LocalExchange
impl Clone for LocalExchange
Source§fn clone(&self) -> LocalExchange
fn clone(&self) -> LocalExchange
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LocalExchange
impl Debug for LocalExchange
Source§impl<'de> Deserialize<'de> for LocalExchange
impl<'de> Deserialize<'de> for LocalExchange
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for LocalExchange
impl PartialEq for LocalExchange
Source§impl Serialize for LocalExchange
impl Serialize for LocalExchange
impl StructuralPartialEq for LocalExchange
Auto Trait Implementations§
impl Freeze for LocalExchange
impl RefUnwindSafe for LocalExchange
impl Send for LocalExchange
impl Sync for LocalExchange
impl Unpin for LocalExchange
impl UnwindSafe for LocalExchange
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.