Skip to content

Commit

Permalink
feat(prime-domain): drafted basic PrimeDomainService trait
Browse files Browse the repository at this point in the history
  • Loading branch information
johnbchron committed Nov 25, 2024
1 parent 7ec6472 commit 12792a2
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Empty file.
27 changes: 27 additions & 0 deletions crates/prime-domain/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,29 @@
//! Provides prime-domain Services, the entry points for domain-specific
//! business logic.
mod canonical;

use std::sync::Arc;

pub use hex;
use hex::Hexagonal;
use models::{Artifact, ArtifactRecordId, Photo, PhotoRecordId};
use repos::db::FetchModelError;

/// A dynamic [`PrimeDomainService`] trait object.
pub type DynPrimeDomainService = Arc<Box<dyn PrimeDomainService>>;

/// The prime domain service trait.
#[async_trait::async_trait]
pub trait PrimeDomainService: Hexagonal {
/// Fetch an [`Artifact`] by its ID.
async fn fetch_cache_by_id(
&self,
id: ArtifactRecordId,
) -> Result<Option<Artifact>, FetchModelError>;
/// Fetch a [`Photo`] by its ID.
async fn fetch_photo_by_id(
&self,
id: PhotoRecordId,
) -> Result<Option<Photo>, FetchModelError>;
}

0 comments on commit 12792a2

Please sign in to comment.