fistinc-auth 0.1.0

Paging types for Fist Inc bank
Documentation
use async_trait::async_trait;
use email_address::EmailAddress;
use fistinc_errors::ServiceResult;
use fistinc_paging::{Paging, QueryParams};
use phonenumber::PhoneNumber;
use uuid::Uuid;

use crate::domain::entity::User;

#[async_trait]
pub trait UserService: Send + Sync {
    async fn create(&self, user: User) -> ServiceResult<User>;
    async fn users(
        &self, params: &dyn QueryParams,
    ) -> ServiceResult<Paging<User>>;
    async fn find_by_id(&self, id: Uuid) -> ServiceResult<Option<User>>;
    async fn find_by_email(&self, email: &EmailAddress) -> ServiceResult<Option<User>>;
    async fn find_by_phone(&self, phone: &PhoneNumber) -> ServiceResult<Option<User>>;
    async fn update(&self, update: &User) -> ServiceResult<()>;
    async fn delete_by_id(&self, id: Uuid) -> ServiceResult<()>;
}