koprogo_api/application/ports/
resolution_repository.rs1use crate::domain::entities::{Resolution, ResolutionStatus};
2use async_trait::async_trait;
3use uuid::Uuid;
4
5#[async_trait]
7pub trait ResolutionRepository: Send + Sync {
8 async fn create(&self, resolution: &Resolution) -> Result<Resolution, String>;
10
11 async fn find_by_id(&self, id: Uuid) -> Result<Option<Resolution>, String>;
13
14 async fn find_by_meeting_id(&self, meeting_id: Uuid) -> Result<Vec<Resolution>, String>;
16
17 async fn find_by_status(&self, status: ResolutionStatus) -> Result<Vec<Resolution>, String>;
19
20 async fn update(&self, resolution: &Resolution) -> Result<Resolution, String>;
22
23 async fn delete(&self, id: Uuid) -> Result<bool, String>;
25
26 async fn update_vote_counts(
28 &self,
29 resolution_id: Uuid,
30 vote_count_pour: i32,
31 vote_count_contre: i32,
32 vote_count_abstention: i32,
33 total_voting_power_pour: f64,
34 total_voting_power_contre: f64,
35 total_voting_power_abstention: f64,
36 ) -> Result<(), String>;
37
38 async fn close_voting(
40 &self,
41 resolution_id: Uuid,
42 final_status: ResolutionStatus,
43 ) -> Result<(), String>;
44
45 async fn get_meeting_vote_summary(&self, meeting_id: Uuid) -> Result<Vec<Resolution>, String>;
47}