refactor(domain): FeedEntry — EngagementStats + Option<ViewerContext> sub-structs
This commit is contained in:
@@ -1,6 +1,30 @@
|
|||||||
use crate::models::{thought::Thought, user::User};
|
use crate::models::{thought::Thought, user::User};
|
||||||
use crate::value_objects::UserId;
|
use crate::value_objects::UserId;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct EngagementStats {
|
||||||
|
pub like_count: i64,
|
||||||
|
pub boost_count: i64,
|
||||||
|
pub reply_count: i64,
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Present only when an authenticated viewer made the request.
|
||||||
|
/// `liked`/`boosted` are the viewer's interaction state with this thought.
|
||||||
|
/// `None` means anonymous request or viewer context unavailable.
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct ViewerContext {
|
||||||
|
pub liked: bool,
|
||||||
|
pub boosted: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct FeedEntry {
|
||||||
|
pub thought: Thought,
|
||||||
|
pub author: User,
|
||||||
|
pub stats: EngagementStats,
|
||||||
|
pub viewer: Option<ViewerContext>,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct UserSummary {
|
pub struct UserSummary {
|
||||||
pub id: UserId,
|
pub id: UserId,
|
||||||
@@ -13,17 +37,6 @@ pub struct UserSummary {
|
|||||||
pub following_count: i64,
|
pub following_count: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
|
||||||
pub struct FeedEntry {
|
|
||||||
pub thought: Thought,
|
|
||||||
pub author: User,
|
|
||||||
pub like_count: i64,
|
|
||||||
pub boost_count: i64,
|
|
||||||
pub reply_count: i64,
|
|
||||||
pub liked_by_viewer: bool,
|
|
||||||
pub boosted_by_viewer: bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct PageParams {
|
pub struct PageParams {
|
||||||
pub page: u64,
|
pub page: u64,
|
||||||
|
|||||||
Reference in New Issue
Block a user