QuoteRepository

Trait QuoteRepository 

Source
pub trait QuoteRepository: Send + Sync {
    // Required methods
    fn create<'life0, 'life1, 'async_trait>(
        &'life0 self,
        quote: &'life1 Quote,
    ) -> Pin<Box<dyn Future<Output = Result<Quote, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn find_by_id<'life0, 'async_trait>(
        &'life0 self,
        id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Quote>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_by_building<'life0, 'async_trait>(
        &'life0 self,
        building_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Quote>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_by_contractor<'life0, 'async_trait>(
        &'life0 self,
        contractor_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Quote>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_by_status<'life0, 'life1, 'async_trait>(
        &'life0 self,
        building_id: Uuid,
        status: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Quote>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn find_by_ids<'life0, 'async_trait>(
        &'life0 self,
        ids: Vec<Uuid>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Quote>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_by_project_title<'life0, 'life1, 'async_trait>(
        &'life0 self,
        building_id: Uuid,
        project_title: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Quote>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn find_expired<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Quote>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update<'life0, 'life1, 'async_trait>(
        &'life0 self,
        quote: &'life1 Quote,
    ) -> Pin<Box<dyn Future<Output = Result<Quote, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete<'life0, 'async_trait>(
        &'life0 self,
        id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn count_by_building<'life0, 'async_trait>(
        &'life0 self,
        building_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<i64, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn count_by_status<'life0, 'life1, 'async_trait>(
        &'life0 self,
        building_id: Uuid,
        status: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<i64, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Port (interface) for Quote repository (Belgian legal requirement: 3 quotes >5000€)

Required Methods§

Source

fn create<'life0, 'life1, 'async_trait>( &'life0 self, quote: &'life1 Quote, ) -> Pin<Box<dyn Future<Output = Result<Quote, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Create new quote

Source

fn find_by_id<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Option<Quote>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find quote by ID

Source

fn find_by_building<'life0, 'async_trait>( &'life0 self, building_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<Quote>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find all quotes for a building

Source

fn find_by_contractor<'life0, 'async_trait>( &'life0 self, contractor_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<Quote>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find all quotes for a contractor

Source

fn find_by_status<'life0, 'life1, 'async_trait>( &'life0 self, building_id: Uuid, status: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Quote>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Find quotes by status

Source

fn find_by_ids<'life0, 'async_trait>( &'life0 self, ids: Vec<Uuid>, ) -> Pin<Box<dyn Future<Output = Result<Vec<Quote>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find multiple quotes by IDs (for comparison)

Source

fn find_by_project_title<'life0, 'life1, 'async_trait>( &'life0 self, building_id: Uuid, project_title: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Quote>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Find quotes for a specific project (by title)

Source

fn find_expired<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<Quote>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find expired quotes (for background job)

Source

fn update<'life0, 'life1, 'async_trait>( &'life0 self, quote: &'life1 Quote, ) -> Pin<Box<dyn Future<Output = Result<Quote, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update quote

Source

fn delete<'life0, 'async_trait>( &'life0 self, id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<bool, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Delete quote

Source

fn count_by_building<'life0, 'async_trait>( &'life0 self, building_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<i64, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Count quotes by building

Source

fn count_by_status<'life0, 'life1, 'async_trait>( &'life0 self, building_id: Uuid, status: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<i64, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Count quotes by status for a building

Implementors§