koprogo_api/application/ports/
owner_repository.rs1use crate::application::dto::{OwnerFilters, PageRequest};
2use crate::domain::entities::Owner;
3use async_trait::async_trait;
4use uuid::Uuid;
5
6#[async_trait]
7pub trait OwnerRepository: Send + Sync {
8 async fn create(&self, owner: &Owner) -> Result<Owner, String>;
9 async fn find_by_id(&self, id: Uuid) -> Result<Option<Owner>, String>;
10 async fn find_by_email(&self, email: &str) -> Result<Option<Owner>, String>;
11 async fn find_all(&self) -> Result<Vec<Owner>, String>;
12
13 async fn find_all_paginated(
16 &self,
17 page_request: &PageRequest,
18 filters: &OwnerFilters,
19 ) -> Result<(Vec<Owner>, i64), String>;
20
21 async fn update(&self, owner: &Owner) -> Result<Owner, String>;
22 async fn delete(&self, id: Uuid) -> Result<bool, String>;
23}