Refactor (#4)

Reviewed-on: #4
This commit is contained in:
2025-12-26 00:32:20 +00:00
parent 58de25e5bc
commit 1bacb454fa
11 changed files with 238 additions and 115 deletions

View File

@@ -1,7 +1,7 @@
use async_trait::async_trait;
use uuid::Uuid;
use crate::entities::NoteLink;
use crate::entities::{Note, NoteLink};
use crate::errors::DomainResult;
/// Defines how to generate vector embeddings from text.
@@ -34,3 +34,12 @@ pub trait LinkRepository: Send + Sync {
/// Get links for a specific source note.
async fn get_links_for_note(&self, source_note_id: Uuid) -> DomainResult<Vec<NoteLink>>;
}
/// Port for publishing domain events to a message broker.
/// Enables the Service layer to trigger background processing
/// without coupling to a specific messaging implementation.
#[async_trait]
pub trait MessageBroker: Send + Sync {
/// Publish an event when a note is created or updated.
async fn publish_note_updated(&self, note: &Note) -> DomainResult<()>;
}