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 moderate_cancel(&mut self, reason: String) -> Result<(), String>
pub fn moderate_cancel(&mut self, reason: String) -> Result<(), String>
Annule un échange PAR MODÉRATION (syndic ou community.moderator),
sans être partie prenante (ni provider_id ni requester_id).
Story 5.3 (#587), INV-4 — l’autorisation de modérer et l’obligation
d’un motif non vide sont vérifiées en AMONT, côté application
(LocalExchangeUseCases), qui seule connaît le rôle de l’appelant :
le domaine ne doit pas importer UserRole pour rester agnostique de
l’identité. Ce point d’entrée ne revérifie donc que les invariants
d’état déjà appliqués par cancel() (pas de double vérification
d’appartenance, contrairement à cancel()).
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
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
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>,
Source§impl PartialEq for LocalExchange
impl PartialEq for LocalExchange
Source§fn eq(&self, other: &LocalExchange) -> bool
fn eq(&self, other: &LocalExchange) -> bool
self and other values to be equal, and is used by ==.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 UnsafeUnpin 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
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
§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