From 7d6f874ae75564a45822c50b944dec9cf69b0133 Mon Sep 17 00:00:00 2001 From: Gabriel Kaszewski Date: Thu, 4 Jun 2026 01:35:45 +0200 Subject: [PATCH] feat: activity feed accepts sort_by param --- crates/api-types/src/diary.rs | 1 + crates/presentation/src/handlers/api.rs | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/api-types/src/diary.rs b/crates/api-types/src/diary.rs index a3fbaf1..663a2b2 100644 --- a/crates/api-types/src/diary.rs +++ b/crates/api-types/src/diary.rs @@ -47,6 +47,7 @@ pub struct DiaryQueryParams { pub struct ActivityFeedQueryParams { pub limit: Option, pub offset: Option, + pub sort_by: Option, } #[derive(Debug, Clone, Serialize, Deserialize, utoipa::ToSchema)] diff --git a/crates/presentation/src/handlers/api.rs b/crates/presentation/src/handlers/api.rs index fc06c3e..0413238 100644 --- a/crates/presentation/src/handlers/api.rs +++ b/crates/presentation/src/handlers/api.rs @@ -213,6 +213,7 @@ pub async fn login( user_id: result.user_id, email: result.email, expires_at: result.expires_at.to_rfc3339(), + role: result.role, })) } @@ -415,6 +416,8 @@ pub async fn get_profile( username: profile.username, bio: profile.bio, avatar_url: profile.avatar_url, + banner_url: profile.banner_url, + role: profile.role, })) } @@ -931,7 +934,11 @@ pub async fn get_activity_feed( GetActivityFeedQuery { limit: params.limit.unwrap_or(20), offset: params.offset.unwrap_or(0), - sort_by: domain::ports::FeedSortBy::Date, + sort_by: params + .sort_by + .as_deref() + .map(|s| s.parse().unwrap_or_default()) + .unwrap_or_default(), search: None, viewer_user_id: None, filter_following: false,