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

This commit is contained in:
2026-05-14 16:13:34 +02:00
parent 004f3cd4d2
commit d50c13a2db
7 changed files with 82 additions and 10 deletions

View File

@@ -0,0 +1,30 @@
use domain::{
errors::DomainError,
models::feed::{PageParams, Paginated},
models::notification::Notification,
ports::NotificationRepository,
value_objects::{NotificationId, UserId},
};
pub async fn list_notifications(
repo: &dyn NotificationRepository,
user_id: &UserId,
page: PageParams,
) -> Result<Paginated<Notification>, DomainError> {
repo.list_for_user(user_id, &page).await
}
pub async fn mark_notification_read(
repo: &dyn NotificationRepository,
id: &NotificationId,
user_id: &UserId,
) -> Result<(), DomainError> {
repo.mark_read(id, user_id).await
}
pub async fn mark_all_notifications_read(
repo: &dyn NotificationRepository,
user_id: &UserId,
) -> Result<(), DomainError> {
repo.mark_all_read(user_id).await
}