feat(domain): DiaryRepository::stream_user_history, DiaryExporter::stream_entries
This commit is contained in:
@@ -144,6 +144,10 @@ pub trait DiaryRepository: Send + Sync {
|
||||
) -> Result<Paginated<FeedEntry>, DomainError>;
|
||||
async fn get_review_history(&self, movie_id: &MovieId) -> Result<ReviewHistory, DomainError>;
|
||||
async fn get_user_history(&self, user_id: &UserId) -> Result<Vec<DiaryEntry>, DomainError>;
|
||||
fn stream_user_history(
|
||||
&self,
|
||||
user_id: UserId,
|
||||
) -> futures::stream::BoxStream<'static, Result<DiaryEntry, DomainError>>;
|
||||
async fn get_movie_stats(&self, movie_id: &MovieId) -> Result<MovieStats, DomainError>;
|
||||
async fn get_movie_social_feed(
|
||||
&self,
|
||||
@@ -253,13 +257,12 @@ pub trait PasswordHasher: Send + Sync {
|
||||
async fn verify(&self, plain_password: &str, hash: &PasswordHash) -> Result<bool, DomainError>;
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
pub trait DiaryExporter: Send + Sync {
|
||||
async fn serialize_entries(
|
||||
fn stream_entries(
|
||||
&self,
|
||||
entries: &[DiaryEntry],
|
||||
stream: futures::stream::BoxStream<'static, Result<DiaryEntry, DomainError>>,
|
||||
format: ExportFormat,
|
||||
) -> Result<Vec<u8>, DomainError>;
|
||||
) -> futures::stream::BoxStream<'static, Result<bytes::Bytes, DomainError>>;
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
|
||||
@@ -154,6 +154,13 @@ impl DiaryRepository for FakeDiaryRepository {
|
||||
Ok(vec![])
|
||||
}
|
||||
|
||||
fn stream_user_history(
|
||||
&self,
|
||||
_user_id: UserId,
|
||||
) -> futures::stream::BoxStream<'static, Result<DiaryEntry, DomainError>> {
|
||||
Box::pin(futures::stream::empty())
|
||||
}
|
||||
|
||||
async fn get_movie_stats(&self, _movie_id: &MovieId) -> Result<MovieStats, DomainError> {
|
||||
Ok(MovieStats {
|
||||
total_count: 0,
|
||||
|
||||
@@ -49,6 +49,12 @@ impl DiaryRepository for PanicDiaryRepository {
|
||||
async fn get_user_history(&self, _: &UserId) -> Result<Vec<DiaryEntry>, DomainError> {
|
||||
panic!("PanicDiaryRepository called")
|
||||
}
|
||||
fn stream_user_history(
|
||||
&self,
|
||||
_: UserId,
|
||||
) -> futures::stream::BoxStream<'static, Result<DiaryEntry, DomainError>> {
|
||||
panic!("PanicDiaryRepository called")
|
||||
}
|
||||
async fn get_movie_stats(&self, _: &MovieId) -> Result<MovieStats, DomainError> {
|
||||
panic!("PanicDiaryRepository called")
|
||||
}
|
||||
@@ -250,13 +256,12 @@ impl PosterFetcherClient for PanicPosterFetcher {
|
||||
|
||||
pub struct PanicDiaryExporter;
|
||||
|
||||
#[async_trait]
|
||||
impl DiaryExporter for PanicDiaryExporter {
|
||||
async fn serialize_entries(
|
||||
fn stream_entries(
|
||||
&self,
|
||||
_: &[DiaryEntry],
|
||||
_: ExportFormat,
|
||||
) -> Result<Vec<u8>, DomainError> {
|
||||
_stream: futures::stream::BoxStream<'static, Result<DiaryEntry, DomainError>>,
|
||||
_format: ExportFormat,
|
||||
) -> futures::stream::BoxStream<'static, Result<bytes::Bytes, DomainError>> {
|
||||
panic!("PanicDiaryExporter called")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user