koprogo_api/application/ports/
quote_repository.rs1use crate::domain::entities::Quote;
2use async_trait::async_trait;
3use uuid::Uuid;
4
5#[async_trait]
7pub trait QuoteRepository: Send + Sync {
8 async fn create(&self, quote: &Quote) -> Result<Quote, String>;
10
11 async fn find_by_id(&self, id: Uuid) -> Result<Option<Quote>, String>;
13
14 async fn find_by_building(&self, building_id: Uuid) -> Result<Vec<Quote>, String>;
16
17 async fn find_by_contractor(&self, contractor_id: Uuid) -> Result<Vec<Quote>, String>;
19
20 async fn find_by_status(&self, building_id: Uuid, status: &str) -> Result<Vec<Quote>, String>;
22
23 async fn find_by_ids(&self, ids: Vec<Uuid>) -> Result<Vec<Quote>, String>;
25
26 async fn find_by_project_title(
28 &self,
29 building_id: Uuid,
30 project_title: &str,
31 ) -> Result<Vec<Quote>, String>;
32
33 async fn find_expired(&self) -> Result<Vec<Quote>, String>;
35
36 async fn update(&self, quote: &Quote) -> Result<Quote, String>;
38
39 async fn delete(&self, id: Uuid) -> Result<bool, String>;
41
42 async fn count_by_building(&self, building_id: Uuid) -> Result<i64, String>;
44
45 async fn count_by_status(&self, building_id: Uuid, status: &str) -> Result<i64, String>;
47}