VoteRepository

Trait VoteRepository 

Source
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§

Source

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

Source

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

Source

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

Source

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)

Source

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

Source

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

Source

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)

Source

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

Source

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,

Count votes for a resolution by choice

Source

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,

Get total voting power for a resolution by choice

Implementors§