48 lines
1.2 KiB
Rust
48 lines
1.2 KiB
Rust
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>,
|
|
}
|