-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(prime-domain): drafted basic
PrimeDomainService
trait
- Loading branch information
1 parent
7ec6472
commit 12792a2
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>; | ||
} |