refactor: wrap direct port calls behind use cases — notifications, search, popular_tags
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Failing after 5m7s
test / unit (pull_request) Successful in 15m51s
test / integration (pull_request) Failing after 17m3s
Some checks failed
lint / lint (push) Has been cancelled
test / unit (push) Has been cancelled
test / integration (push) Has been cancelled
lint / lint (pull_request) Failing after 5m7s
test / unit (pull_request) Successful in 15m51s
test / integration (pull_request) Failing after 17m3s
This commit is contained in:
26
crates/application/src/use_cases/search.rs
Normal file
26
crates/application/src/use_cases/search.rs
Normal file
@@ -0,0 +1,26 @@
|
||||
use domain::{
|
||||
errors::DomainError,
|
||||
models::{
|
||||
feed::{FeedEntry, PageParams, Paginated},
|
||||
user::User,
|
||||
},
|
||||
ports::SearchPort,
|
||||
value_objects::UserId,
|
||||
};
|
||||
|
||||
pub async fn search_thoughts(
|
||||
search: &dyn SearchPort,
|
||||
query: &str,
|
||||
page: PageParams,
|
||||
viewer_id: Option<&UserId>,
|
||||
) -> Result<Paginated<FeedEntry>, DomainError> {
|
||||
search.search_thoughts(query, &page, viewer_id).await
|
||||
}
|
||||
|
||||
pub async fn search_users(
|
||||
search: &dyn SearchPort,
|
||||
query: &str,
|
||||
page: PageParams,
|
||||
) -> Result<Paginated<User>, DomainError> {
|
||||
search.search_users(query, &page).await
|
||||
}
|
||||
Reference in New Issue
Block a user