feat(domain): models

This commit is contained in:
2026-05-14 03:18:49 +02:00
parent 94a3f414e4
commit 4b8d1027c1
14 changed files with 238 additions and 1 deletions

View File

@@ -0,0 +1,40 @@
use crate::models::{user::User, thought::Thought};
use crate::value_objects::UserId;
#[derive(Debug, Clone)]
pub struct UserSummary {
pub id: UserId,
pub username: String,
pub display_name: Option<String>,
pub avatar_url: Option<String>,
pub bio: Option<String>,
pub thought_count: i64,
pub follower_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)]
pub struct PageParams { pub page: u64, pub per_page: u64 }
impl PageParams {
pub fn offset(&self) -> i64 { ((self.page.saturating_sub(1)) * self.per_page) as i64 }
pub fn limit(&self) -> i64 { self.per_page as i64 }
}
#[derive(Debug, Clone)]
pub struct Paginated<T> {
pub items: Vec<T>,
pub total: i64,
pub page: u64,
pub per_page: u64,
}