pub struct Vote {
pub id: Uuid,
pub resolution_id: Uuid,
pub owner_id: Uuid,
pub unit_id: Uuid,
pub vote_choice: VoteChoice,
pub voting_power: Decimal,
pub proxy_owner_id: Option<Uuid>,
pub voted_at: DateTime<Utc>,
pub auth_method: VoteAuthMethod,
}Expand description
Vote d’un propriétaire sur une résolution
Fields§
§id: Uuid§resolution_id: Uuid§owner_id: Uuid§unit_id: Uuid§vote_choice: VoteChoice§voting_power: Decimal§proxy_owner_id: Option<Uuid>§voted_at: DateTime<Utc>§auth_method: VoteAuthMethodStory 4.2 — comment le votant a été authentifié (#48). Par défaut
Presence (Vote::new) : seul cast_vote, une fois auth_method
validé contre la modalité de l’AG, appelle new_with_auth_method.
Implementations§
Source§impl Vote
impl Vote
Sourcepub fn new(
resolution_id: Uuid,
owner_id: Uuid,
unit_id: Uuid,
vote_choice: VoteChoice,
voting_power: Decimal,
proxy_owner_id: Option<Uuid>,
) -> Result<Self, String>
pub fn new( resolution_id: Uuid, owner_id: Uuid, unit_id: Uuid, vote_choice: VoteChoice, voting_power: Decimal, proxy_owner_id: Option<Uuid>, ) -> Result<Self, String>
Crée un nouveau vote
Sourcepub fn new_with_auth_method(
resolution_id: Uuid,
owner_id: Uuid,
unit_id: Uuid,
vote_choice: VoteChoice,
voting_power: Decimal,
proxy_owner_id: Option<Uuid>,
auth_method: VoteAuthMethod,
) -> Result<Self, String>
pub fn new_with_auth_method( resolution_id: Uuid, owner_id: Uuid, unit_id: Uuid, vote_choice: VoteChoice, voting_power: Decimal, proxy_owner_id: Option<Uuid>, auth_method: VoteAuthMethod, ) -> Result<Self, String>
Story 4.2 — variante de new() qui pose explicitement auth_method.
Employée par le cas d’usage cast_vote, une fois la méthode validée
contre la modalité de l’AG (assert_vote_auth_sufficient). Les autres
appelants (tests de plafonnement, procurations, conflits d’intérêts)
ne portent pas cette dimension et gardent new(), qui vaut
Presence par défaut.
Sourcepub fn is_proxy_vote(&self) -> bool
pub fn is_proxy_vote(&self) -> bool
Vérifie si le vote est exprimé par procuration
Sourcepub fn effective_voter_id(&self) -> Uuid
pub fn effective_voter_id(&self) -> Uuid
Retourne l’ID du votant effectif (propriétaire ou mandataire)
Sourcepub fn change_vote(&mut self, new_choice: VoteChoice) -> Result<(), String>
pub fn change_vote(&mut self, new_choice: VoteChoice) -> Result<(), String>
Modifie le choix de vote (seulement si pas encore enregistré)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Vote
impl<'de> Deserialize<'de> for Vote
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 From<Vote> for VoteResponse
impl From<Vote> for VoteResponse
impl StructuralPartialEq for Vote
Auto Trait Implementations§
impl Freeze for Vote
impl RefUnwindSafe for Vote
impl Send for Vote
impl Sync for Vote
impl Unpin for Vote
impl UnsafeUnpin for Vote
impl UnwindSafe for Vote
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