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§
Sourcefn 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 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
Sourcefn 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_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
Sourcefn 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_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)
Sourcefn 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_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
Sourcefn 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_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)
Sourcefn 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_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
Sourcefn 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_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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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