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,47 @@
use chrono::{DateTime, Utc};
use crate::value_objects::{UserId, ThoughtId, LikeId, BoostId};
#[derive(Debug, Clone)]
pub struct Like {
pub id: LikeId,
pub user_id: UserId,
pub thought_id: ThoughtId,
pub ap_id: Option<String>,
pub created_at: DateTime<Utc>,
}
#[derive(Debug, Clone)]
pub struct Boost {
pub id: BoostId,
pub user_id: UserId,
pub thought_id: ThoughtId,
pub ap_id: Option<String>,
pub created_at: DateTime<Utc>,
}
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum FollowState { Pending, Accepted, Rejected }
impl FollowState {
pub fn from_str(s: &str) -> Self {
match s { "pending" => Self::Pending, "rejected" => Self::Rejected, _ => Self::Accepted }
}
pub fn as_str(&self) -> &str {
match self { Self::Pending => "pending", Self::Accepted => "accepted", Self::Rejected => "rejected" }
}
}
#[derive(Debug, Clone)]
pub struct Follow {
pub follower_id: UserId,
pub following_id: UserId,
pub state: FollowState,
pub ap_id: Option<String>,
pub created_at: DateTime<Utc>,
}
#[derive(Debug, Clone)]
pub struct Block {
pub blocker_id: UserId,
pub blocked_id: UserId,
pub created_at: DateTime<Utc>,
}