pub struct ResolutionUseCases { /* private fields */ }Implementations§
Source§impl ResolutionUseCases
impl ResolutionUseCases
pub fn new( resolution_repository: Arc<dyn ResolutionRepository>, vote_repository: Arc<dyn VoteRepository>, ) -> Self
Sourcepub async fn create_resolution(
&self,
meeting_id: Uuid,
title: String,
description: String,
resolution_type: ResolutionType,
majority_required: MajorityType,
) -> Result<Resolution, String>
pub async fn create_resolution( &self, meeting_id: Uuid, title: String, description: String, resolution_type: ResolutionType, majority_required: MajorityType, ) -> Result<Resolution, String>
Create a new resolution for a meeting
Sourcepub async fn get_resolution(
&self,
id: Uuid,
) -> Result<Option<Resolution>, String>
pub async fn get_resolution( &self, id: Uuid, ) -> Result<Option<Resolution>, String>
Get a resolution by ID
Sourcepub async fn get_meeting_resolutions(
&self,
meeting_id: Uuid,
) -> Result<Vec<Resolution>, String>
pub async fn get_meeting_resolutions( &self, meeting_id: Uuid, ) -> Result<Vec<Resolution>, String>
Get all resolutions for a meeting
Sourcepub async fn get_resolutions_by_status(
&self,
status: ResolutionStatus,
) -> Result<Vec<Resolution>, String>
pub async fn get_resolutions_by_status( &self, status: ResolutionStatus, ) -> Result<Vec<Resolution>, String>
Get resolutions by status
Sourcepub async fn update_resolution(
&self,
resolution: &Resolution,
) -> Result<Resolution, String>
pub async fn update_resolution( &self, resolution: &Resolution, ) -> Result<Resolution, String>
Update a resolution (only allowed if status is Pending)
Sourcepub async fn delete_resolution(&self, id: Uuid) -> Result<bool, String>
pub async fn delete_resolution(&self, id: Uuid) -> Result<bool, String>
Delete a resolution (only allowed if no votes have been cast)
Sourcepub async fn cast_vote(
&self,
resolution_id: Uuid,
owner_id: Uuid,
unit_id: Uuid,
vote_choice: VoteChoice,
voting_power: f64,
proxy_owner_id: Option<Uuid>,
) -> Result<Vote, String>
pub async fn cast_vote( &self, resolution_id: Uuid, owner_id: Uuid, unit_id: Uuid, vote_choice: VoteChoice, voting_power: f64, proxy_owner_id: Option<Uuid>, ) -> Result<Vote, String>
Cast a vote on a resolution
Sourcepub async fn change_vote(
&self,
vote_id: Uuid,
new_choice: VoteChoice,
) -> Result<Vote, String>
pub async fn change_vote( &self, vote_id: Uuid, new_choice: VoteChoice, ) -> Result<Vote, String>
Change a vote (if allowed by business rules)
Sourcepub async fn get_resolution_votes(
&self,
resolution_id: Uuid,
) -> Result<Vec<Vote>, String>
pub async fn get_resolution_votes( &self, resolution_id: Uuid, ) -> Result<Vec<Vote>, String>
Get all votes for a resolution
Sourcepub async fn get_owner_votes(&self, owner_id: Uuid) -> Result<Vec<Vote>, String>
pub async fn get_owner_votes(&self, owner_id: Uuid) -> Result<Vec<Vote>, String>
Get all votes by an owner
Sourcepub async fn close_voting(
&self,
resolution_id: Uuid,
total_voting_power: f64,
) -> Result<Resolution, String>
pub async fn close_voting( &self, resolution_id: Uuid, total_voting_power: f64, ) -> Result<Resolution, String>
Close voting on a resolution and calculate final result
Sourcepub async fn get_meeting_vote_summary(
&self,
meeting_id: Uuid,
) -> Result<Vec<Resolution>, String>
pub async fn get_meeting_vote_summary( &self, meeting_id: Uuid, ) -> Result<Vec<Resolution>, String>
Get vote summary for a meeting (all resolutions with their results)
Sourcepub async fn has_unit_voted(
&self,
resolution_id: Uuid,
unit_id: Uuid,
) -> Result<bool, String>
pub async fn has_unit_voted( &self, resolution_id: Uuid, unit_id: Uuid, ) -> Result<bool, String>
Check if a unit has voted on a resolution
Sourcepub async fn get_vote_statistics(
&self,
resolution_id: Uuid,
) -> Result<VoteStatistics, String>
pub async fn get_vote_statistics( &self, resolution_id: Uuid, ) -> Result<VoteStatistics, String>
Get vote statistics for a resolution
Auto Trait Implementations§
impl Freeze for ResolutionUseCases
impl !RefUnwindSafe for ResolutionUseCases
impl Send for ResolutionUseCases
impl Sync for ResolutionUseCases
impl Unpin for ResolutionUseCases
impl !UnwindSafe for ResolutionUseCases
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
§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.