koprogo_api/application/ports/
user_repository.rs

1use crate::domain::entities::User;
2use async_trait::async_trait;
3use uuid::Uuid;
4
5#[async_trait]
6pub trait UserRepository: Send + Sync {
7    async fn create(&self, user: &User) -> Result<User, String>;
8    async fn find_by_id(&self, id: Uuid) -> Result<Option<User>, String>;
9    async fn find_by_email(&self, email: &str) -> Result<Option<User>, String>;
10    async fn find_all(&self) -> Result<Vec<User>, String>;
11    async fn find_by_organization(&self, org_id: Uuid) -> Result<Vec<User>, String>;
12    async fn update(&self, user: &User) -> Result<User, String>;
13    async fn delete(&self, id: Uuid) -> Result<bool, String>;
14    async fn count_by_organization(&self, org_id: Uuid) -> Result<i64, String>;
15}