koprogo_api/application/ports/
resolution_repository.rs1use crate::domain::entities::{Resolution, ResolutionStatus};
2use async_trait::async_trait;
3use rust_decimal::Decimal;
4use uuid::Uuid;
5
6#[async_trait]
8pub trait ResolutionRepository: Send + Sync {
9 async fn create(&self, resolution: &Resolution) -> Result<Resolution, String>;
11
12 async fn find_by_id(&self, id: Uuid) -> Result<Option<Resolution>, String>;
14
15 async fn find_by_meeting_id(&self, meeting_id: Uuid) -> Result<Vec<Resolution>, String>;
17
18 async fn find_by_status(&self, status: ResolutionStatus) -> Result<Vec<Resolution>, String>;
20
21 async fn update(&self, resolution: &Resolution) -> Result<Resolution, String>;
23
24 async fn delete(&self, id: Uuid) -> Result<bool, String>;
26
27 async fn update_vote_counts(
29 &self,
30 resolution_id: Uuid,
31 vote_count_pour: i32,
32 vote_count_contre: i32,
33 vote_count_abstention: i32,
34 total_voting_power_pour: Decimal,
35 total_voting_power_contre: Decimal,
36 total_voting_power_abstention: Decimal,
37 ) -> Result<(), String>;
38
39 async fn close_voting(
51 &self,
52 resolution_id: Uuid,
53 final_status: ResolutionStatus,
54 voix_plafonnees: Option<serde_json::Value>,
55 ) -> Result<(), String>;
56
57 async fn get_meeting_vote_summary(&self, meeting_id: Uuid) -> Result<Vec<Resolution>, String>;
59}