koprogo_api/application/ports/
convocation_repository.rs1use crate::domain::entities::{Convocation, ConvocationStatus};
2use async_trait::async_trait;
3use chrono::{DateTime, Utc};
4use uuid::Uuid;
5
6#[async_trait]
7pub trait ConvocationRepository: Send + Sync {
8 async fn create(&self, convocation: &Convocation) -> Result<Convocation, String>;
10
11 async fn find_by_id(&self, id: Uuid) -> Result<Option<Convocation>, String>;
13
14 async fn find_by_meeting_id(&self, meeting_id: Uuid) -> Result<Option<Convocation>, String>;
16
17 async fn find_by_building(&self, building_id: Uuid) -> Result<Vec<Convocation>, String>;
19
20 async fn find_by_organization(&self, organization_id: Uuid)
22 -> Result<Vec<Convocation>, String>;
23
24 async fn find_by_status(
26 &self,
27 organization_id: Uuid,
28 status: ConvocationStatus,
29 ) -> Result<Vec<Convocation>, String>;
30
31 async fn find_pending_scheduled(&self, now: DateTime<Utc>) -> Result<Vec<Convocation>, String>;
33
34 async fn find_needing_reminder(&self, now: DateTime<Utc>) -> Result<Vec<Convocation>, String>;
36
37 async fn update(&self, convocation: &Convocation) -> Result<Convocation, String>;
39
40 async fn delete(&self, id: Uuid) -> Result<bool, String>;
42
43 async fn count_by_building(&self, building_id: Uuid) -> Result<i64, String>;
45
46 async fn count_by_status(
48 &self,
49 organization_id: Uuid,
50 status: ConvocationStatus,
51 ) -> Result<i64, String>;
52}