puerto 0.19.1

Puerto — Rust full-stack DDD framework CLI. Scaffolds Clean Architecture projects with auto-wired DI, SQLx support, and zero manual wiring. Formerly puerto-framework.
//! 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>;
        }
    }
}