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,24 @@
use chrono::{DateTime, Utc};
use crate::value_objects::{NotificationId, UserId, ThoughtId};
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum NotificationType { Like, Boost, Follow, Mention, Reply }
impl NotificationType {
pub fn from_str(s: &str) -> Self {
match s { "like" => Self::Like, "boost" => Self::Boost, "follow" => Self::Follow, "mention" => Self::Mention, _ => Self::Reply }
}
pub fn as_str(&self) -> &str {
match self { Self::Like => "like", Self::Boost => "boost", Self::Follow => "follow", Self::Mention => "mention", Self::Reply => "reply" }
}
}
#[derive(Debug, Clone)]
pub struct Notification {
pub id: NotificationId,
pub user_id: UserId,
pub notification_type: NotificationType,
pub from_user_id: Option<UserId>,
pub thought_id: Option<ThoughtId>,
pub read: bool,
pub created_at: DateTime<Utc>,
}