BudgetRepository

Trait BudgetRepository 

Source
pub trait BudgetRepository: Send + Sync {
    // Required methods
    fn create<'life0, 'life1, 'async_trait>(
        &'life0 self,
        budget: &'life1 Budget,
    ) -> Pin<Box<dyn Future<Output = Result<Budget, 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<Budget>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_by_building_and_fiscal_year<'life0, 'async_trait>(
        &'life0 self,
        building_id: Uuid,
        fiscal_year: i32,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Budget>, 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<Budget>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_active_by_building<'life0, 'async_trait>(
        &'life0 self,
        building_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Budget>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_by_fiscal_year<'life0, 'async_trait>(
        &'life0 self,
        organization_id: Uuid,
        fiscal_year: i32,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Budget>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_by_status<'life0, 'async_trait>(
        &'life0 self,
        organization_id: Uuid,
        status: BudgetStatus,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Budget>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn find_all_paginated<'life0, 'life1, 'async_trait>(
        &'life0 self,
        page_request: &'life1 PageRequest,
        organization_id: Option<Uuid>,
        building_id: Option<Uuid>,
        status: Option<BudgetStatus>,
    ) -> Pin<Box<dyn Future<Output = Result<(Vec<Budget>, i64), String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update<'life0, 'life1, 'async_trait>(
        &'life0 self,
        budget: &'life1 Budget,
    ) -> Pin<Box<dyn Future<Output = Result<Budget, 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 get_stats<'life0, 'async_trait>(
        &'life0 self,
        organization_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<BudgetStatsResponse, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_variance<'life0, 'async_trait>(
        &'life0 self,
        budget_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Option<BudgetVarianceResponse>, String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Repository trait for Budget persistence

Required Methods§

Source

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

Create a new budget

Source

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

Find budget by ID

Source

fn find_by_building_and_fiscal_year<'life0, 'async_trait>( &'life0 self, building_id: Uuid, fiscal_year: i32, ) -> Pin<Box<dyn Future<Output = Result<Option<Budget>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find budget by building and fiscal year (should be unique)

Source

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

Find all budgets for a building

Source

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

Find active budget for a building (status = Approved, most recent fiscal year)

Source

fn find_by_fiscal_year<'life0, 'async_trait>( &'life0 self, organization_id: Uuid, fiscal_year: i32, ) -> Pin<Box<dyn Future<Output = Result<Vec<Budget>, String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Find budgets by fiscal year across all buildings in organization

Source

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

Find budgets by status

Source

fn find_all_paginated<'life0, 'life1, 'async_trait>( &'life0 self, page_request: &'life1 PageRequest, organization_id: Option<Uuid>, building_id: Option<Uuid>, status: Option<BudgetStatus>, ) -> Pin<Box<dyn Future<Output = Result<(Vec<Budget>, i64), String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Find all budgets paginated

Source

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

Update existing budget

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 budget by ID

Source

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

Get budget statistics for dashboard

Source

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

Get budget variance analysis (budget vs actual expenses)

Implementors§