koprogo_api/application/ports/
charge_distribution_repository.rs1use crate::domain::entities::ChargeDistribution;
2use async_trait::async_trait;
3use rust_decimal::Decimal;
4use uuid::Uuid;
5
6#[async_trait]
7pub trait ChargeDistributionRepository: Send + Sync {
8 async fn create(&self, distribution: &ChargeDistribution)
10 -> Result<ChargeDistribution, String>;
11
12 async fn create_bulk(
14 &self,
15 distributions: &[ChargeDistribution],
16 ) -> Result<Vec<ChargeDistribution>, String>;
17
18 async fn find_by_id(&self, id: Uuid) -> Result<Option<ChargeDistribution>, String>;
20
21 async fn find_by_expense(&self, expense_id: Uuid) -> Result<Vec<ChargeDistribution>, String>;
23
24 async fn find_by_unit(&self, unit_id: Uuid) -> Result<Vec<ChargeDistribution>, String>;
26
27 async fn find_by_owner(&self, owner_id: Uuid) -> Result<Vec<ChargeDistribution>, String>;
29
30 async fn delete_by_expense(&self, expense_id: Uuid) -> Result<(), String>;
32
33 async fn get_total_due_by_owner(&self, owner_id: Uuid) -> Result<Decimal, String>;
35}