koprogo_api/application/ports/
age_request_repository.rs1use crate::domain::entities::age_request::{AgeRequest, AgeRequestCosignatory};
2use async_trait::async_trait;
3use uuid::Uuid;
4
5#[async_trait]
6pub trait AgeRequestRepository: Send + Sync {
7 async fn create(&self, age_request: &AgeRequest) -> Result<AgeRequest, String>;
9
10 async fn find_by_id(&self, id: Uuid) -> Result<Option<AgeRequest>, String>;
12
13 async fn find_by_building(&self, building_id: Uuid) -> Result<Vec<AgeRequest>, String>;
15
16 async fn find_by_organization(&self, organization_id: Uuid) -> Result<Vec<AgeRequest>, String>;
18
19 async fn update(&self, age_request: &AgeRequest) -> Result<AgeRequest, String>;
21
22 async fn delete(&self, id: Uuid) -> Result<bool, String>;
24
25 async fn add_cosignatory(&self, cosignatory: &AgeRequestCosignatory) -> Result<(), String>;
27
28 async fn remove_cosignatory(
30 &self,
31 age_request_id: Uuid,
32 owner_id: Uuid,
33 ) -> Result<bool, String>;
34
35 async fn find_cosignatories(
37 &self,
38 age_request_id: Uuid,
39 ) -> Result<Vec<AgeRequestCosignatory>, String>;
40
41 async fn find_expired_deadlines(&self) -> Result<Vec<AgeRequest>, String>;
43}