feat: identity: define type aliases for services

This commit is contained in:
Aravinth Manivannan 2024-05-19 00:35:16 +05:30
parent cef61fe229
commit 51894cfcb7
Signed by: realaravinth
GPG key ID: F8F50389936984FF
6 changed files with 16 additions and 4 deletions

View file

@ -9,10 +9,12 @@ pub mod service;
use super::errors::*;
#[async_trait::async_trait]
pub trait DeleteUserUseCase {
pub trait DeleteUserUseCase: Send + Sync {
async fn delete_user(
&self,
cmd: command::DeleteUserCommand,
//) -> errors::ProcessAuthorizationServiceResult<String>;
);
}
pub type DeleteUserServiceObj = std::sync::Arc<dyn DeleteUserUseCase>;

View file

@ -9,10 +9,12 @@ pub mod service;
use super::errors::*;
#[async_trait::async_trait]
pub trait LoginUseCase {
pub trait LoginUseCase: Send + Sync {
async fn login(
&self,
cmd: command::LoginCommand,
//) -> errors::ProcessAuthorizationServiceResult<String>;
) -> events::LoginEvent;
}
pub type LoginServiceObj = std::sync::Arc<dyn LoginUseCase>;

View file

@ -8,7 +8,9 @@ pub mod service;
use super::errors::*;
#[async_trait::async_trait]
pub trait MarkUserVerifiedUseCase {
pub trait MarkUserVerifiedUseCase: Send + Sync {
async fn mark_user_verified(&self, cmd: command::MarkUserVerifiedCommand)
-> IdentityResult<()>;
}
pub type MarkUserVerifiedServiceObj = std::sync::Arc<dyn MarkUserVerifiedUseCase>;

View file

@ -15,3 +15,5 @@ pub trait RegisterUserUseCase: Send + Sync {
cmd: command::RegisterUserCommand,
) -> IdentityResult<events::UserRegisteredEvent>;
}
pub type RegisterUserServiceObj = std::sync::Arc<dyn RegisterUserUseCase>;

View file

@ -14,3 +14,5 @@ pub trait ResendVerificationEmailUseCase: Send + Sync {
cmd: command::ResendVerificationEmailCommand,
) -> IdentityResult<()>;
}
pub type ResendVerificationEmailServiceObj = std::sync::Arc<dyn ResendVerificationEmailUseCase>;

View file

@ -9,10 +9,12 @@ pub mod service;
use super::errors::*;
#[async_trait::async_trait]
pub trait UpdatePasswordUseCase {
pub trait UpdatePasswordUseCase: Send + Sync {
async fn update_password(
&self,
cmd: command::UpdatePasswordCommand,
//) -> errors::ProcessAuthorizationServiceResult<String>;
) -> events::PasswordUpdatedEvent;
}
pub type UpdatePasswordServiceObj = std::sync::Arc<dyn UpdatePasswordUseCase>;