pub trait VoteRepository: Send + Sync {
// Required methods
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
vote: &'life1 Vote,
) -> Pin<Box<dyn Future<Output = Result<Vote, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn find_by_id<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Vote>, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn find_by_resolution_id<'life0, 'async_trait>(
&'life0 self,
resolution_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vote>, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn find_by_owner_id<'life0, 'async_trait>(
&'life0 self,
owner_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vote>, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn find_by_resolution_and_unit<'life0, 'async_trait>(
&'life0 self,
resolution_id: Uuid,
unit_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Vote>, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn has_voted<'life0, 'async_trait>(
&'life0 self,
resolution_id: Uuid,
unit_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
vote: &'life1 Vote,
) -> Pin<Box<dyn Future<Output = Result<Vote, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn count_by_resolution_and_choice<'life0, 'async_trait>(
&'life0 self,
resolution_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(i32, i32, i32), String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn sum_voting_power_by_resolution<'life0, 'async_trait>(
&'life0 self,
resolution_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<(f64, f64, f64), String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Port (trait) for Vote repository operations
Required Methods§
Sourcefn create<'life0, 'life1, 'async_trait>(
&'life0 self,
vote: &'life1 Vote,
) -> Pin<Box<dyn Future<Output = Result<Vote, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create<'life0, 'life1, 'async_trait>(
&'life0 self,
vote: &'life1 Vote,
) -> Pin<Box<dyn Future<Output = Result<Vote, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Cast a vote on a resolution
Sourcefn find_by_id<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Vote>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_id<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Vote>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Find a vote by ID
Sourcefn find_by_resolution_id<'life0, 'async_trait>(
&'life0 self,
resolution_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vote>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_resolution_id<'life0, 'async_trait>(
&'life0 self,
resolution_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vote>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Find all votes for a resolution
Sourcefn find_by_owner_id<'life0, 'async_trait>(
&'life0 self,
owner_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vote>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_owner_id<'life0, 'async_trait>(
&'life0 self,
owner_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vote>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Find all votes by an owner (across all resolutions)
Sourcefn find_by_resolution_and_unit<'life0, 'async_trait>(
&'life0 self,
resolution_id: Uuid,
unit_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Vote>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn find_by_resolution_and_unit<'life0, 'async_trait>(
&'life0 self,
resolution_id: Uuid,
unit_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<Option<Vote>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Find a vote for a specific unit on a specific resolution
Sourcefn has_voted<'life0, 'async_trait>(
&'life0 self,
resolution_id: Uuid,
unit_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn has_voted<'life0, 'async_trait>(
&'life0 self,
resolution_id: Uuid,
unit_id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check if a unit has already voted on a resolution
Sourcefn update<'life0, 'life1, 'async_trait>(
&'life0 self,
vote: &'life1 Vote,
) -> Pin<Box<dyn Future<Output = Result<Vote, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn update<'life0, 'life1, 'async_trait>(
&'life0 self,
vote: &'life1 Vote,
) -> Pin<Box<dyn Future<Output = Result<Vote, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Update a vote (for changing vote choice)
Sourcefn delete<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete<'life0, 'async_trait>(
&'life0 self,
id: Uuid,
) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete a vote