koprogo_api/application/ports/
charge_distribution_repository.rs1use crate::domain::entities::ChargeDistribution;
2use async_trait::async_trait;
3use uuid::Uuid;
4
5#[async_trait]
6pub trait ChargeDistributionRepository: Send + Sync {
7 async fn create(&self, distribution: &ChargeDistribution)
9 -> Result<ChargeDistribution, String>;
10
11 async fn create_bulk(
13 &self,
14 distributions: &[ChargeDistribution],
15 ) -> Result<Vec<ChargeDistribution>, String>;
16
17 async fn find_by_id(&self, id: Uuid) -> Result<Option<ChargeDistribution>, String>;
19
20 async fn find_by_expense(&self, expense_id: Uuid) -> Result<Vec<ChargeDistribution>, String>;
22
23 async fn find_by_unit(&self, unit_id: Uuid) -> Result<Vec<ChargeDistribution>, String>;
25
26 async fn find_by_owner(&self, owner_id: Uuid) -> Result<Vec<ChargeDistribution>, String>;
28
29 async fn delete_by_expense(&self, expense_id: Uuid) -> Result<(), String>;
31
32 async fn get_total_due_by_owner(&self, owner_id: Uuid) -> Result<f64, String>;
34}