koprogo_api/application/ports/
skill_repository.rs1use crate::domain::entities::{ExpertiseLevel, Skill, SkillCategory};
2use async_trait::async_trait;
3use uuid::Uuid;
4
5#[async_trait]
7pub trait SkillRepository: Send + Sync {
8 async fn create(&self, skill: &Skill) -> Result<Skill, String>;
10
11 async fn find_by_id(&self, id: Uuid) -> Result<Option<Skill>, String>;
13
14 async fn find_by_building(&self, building_id: Uuid) -> Result<Vec<Skill>, String>;
16
17 async fn find_available_by_building(&self, building_id: Uuid) -> Result<Vec<Skill>, String>;
19
20 async fn find_by_owner(&self, owner_id: Uuid) -> Result<Vec<Skill>, String>;
22
23 async fn find_by_category(
25 &self,
26 building_id: Uuid,
27 category: SkillCategory,
28 ) -> Result<Vec<Skill>, String>;
29
30 async fn find_by_expertise(
32 &self,
33 building_id: Uuid,
34 level: ExpertiseLevel,
35 ) -> Result<Vec<Skill>, String>;
36
37 async fn find_free_by_building(&self, building_id: Uuid) -> Result<Vec<Skill>, String>;
39
40 async fn find_professional_by_building(&self, building_id: Uuid) -> Result<Vec<Skill>, String>;
42
43 async fn update(&self, skill: &Skill) -> Result<Skill, String>;
45
46 async fn delete(&self, id: Uuid) -> Result<(), String>;
48
49 async fn count_by_building(&self, building_id: Uuid) -> Result<i64, String>;
51
52 async fn count_available_by_building(&self, building_id: Uuid) -> Result<i64, String>;
54
55 async fn count_by_category(
57 &self,
58 building_id: Uuid,
59 category: SkillCategory,
60 ) -> Result<i64, String>;
61
62 async fn count_by_expertise(
64 &self,
65 building_id: Uuid,
66 level: ExpertiseLevel,
67 ) -> Result<i64, String>;
68}