koprogo_api/application/ports/
stats_repository.rs

1use crate::application::dto::{
2    AdminDashboardStats, SeedDataStats, SyndicDashboardStats, UrgentTask,
3};
4use async_trait::async_trait;
5use uuid::Uuid;
6
7#[async_trait]
8pub trait StatsRepository: Send + Sync {
9    async fn get_admin_dashboard_stats(&self) -> Result<AdminDashboardStats, String>;
10
11    async fn get_seed_data_stats(&self) -> Result<SeedDataStats, String>;
12
13    /// Returns stats for all buildings in the given organization.
14    async fn get_syndic_stats(&self, organization_id: Uuid)
15        -> Result<SyndicDashboardStats, String>;
16
17    /// Returns stats for buildings where the given owner has active units.
18    async fn get_owner_stats(&self, owner_id: Uuid) -> Result<SyndicDashboardStats, String>;
19
20    /// Looks up the owner record id associated with a user id.
21    async fn find_owner_id_by_user_id(&self, user_id: Uuid) -> Result<Option<Uuid>, String>;
22
23    /// Returns urgent tasks (overdue expenses, upcoming meetings, old pending charges)
24    /// for the given organization.
25    async fn get_syndic_urgent_tasks(
26        &self,
27        organization_id: Uuid,
28    ) -> Result<Vec<UrgentTask>, String>;
29}