puerto 0.10.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.
use async_trait::async_trait;
use uuid::Uuid;

use super::{errors::{{ pascal }}Error, model::{{ pascal }}};

#[async_trait]
pub trait {{ pascal }}RepositoryTrait: Send + Sync {
    async fn find_all(&self) -> Result<Vec<{{ pascal }}>, {{ pascal }}Error>;
    async fn find_by_id(&self, id: Uuid) -> Result<Option<{{ pascal }}>, {{ pascal }}Error>;
    async fn save(&self, entity: &{{ pascal }}) -> Result<(), {{ pascal }}Error>;
}

#[cfg(any(test, feature = "test-utils"))]
pub mod mocks {
    use mockall::mock;
    use uuid::Uuid;

    use super::*;

    mock! {
        pub {{ pascal }}Repository {}

        #[async_trait]
        impl {{ pascal }}RepositoryTrait for {{ pascal }}Repository {
            async fn find_all(&self) -> Result<Vec<{{ pascal }}>, {{ pascal }}Error>;
            async fn find_by_id(&self, id: Uuid) -> Result<Option<{{ pascal }}>, {{ pascal }}Error>;
            async fn save(&self, entity: &{{ pascal }}) -> Result<(), {{ pascal }}Error>;
        }
    }
}