//! Yours: `puerto new --auth local` writes this file once.
use async_trait::async_trait;
use crate::domain::user::{errors::UserError, model::User};
/// A new account: an email no other account has, and a password of at least
/// `MIN_PASSWORD_LENGTH` characters.
pub struct RegisterUserParams {
pub email: String,
pub password: String,
pub name: Option<String>,
}
#[async_trait]
pub trait RegisterUserUseCaseTrait: Send + Sync {
async fn execute(&self, params: RegisterUserParams) -> Result<User, UserError>;
}
#[cfg(any(test, feature = "test-utils"))]
pub mod mocks {
use mockall::mock;
use super::*;
mock! {
pub RegisterUserUseCase {}
#[async_trait]
impl RegisterUserUseCaseTrait for RegisterUserUseCase {
async fn execute(&self, params: RegisterUserParams) -> Result<User, UserError>;
}
}
}