Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: If8fe8b38c1d9c4fecd40ff71f88d2ae06a6a6964
51 lines
1.4 KiB
Rust
51 lines
1.4 KiB
Rust
//! Social features: ratings, comments, favorites, and share links.
|
|
|
|
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
use uuid::Uuid;
|
|
|
|
use crate::{model::MediaId, users::UserId};
|
|
|
|
/// A user's rating for a media item.
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct Rating {
|
|
pub id: Uuid,
|
|
pub user_id: UserId,
|
|
pub media_id: MediaId,
|
|
pub stars: u8,
|
|
pub review_text: Option<String>,
|
|
pub created_at: DateTime<Utc>,
|
|
}
|
|
|
|
/// A comment on a media item, supporting threaded replies.
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct Comment {
|
|
pub id: Uuid,
|
|
pub user_id: UserId,
|
|
pub media_id: MediaId,
|
|
pub parent_comment_id: Option<Uuid>,
|
|
pub text: String,
|
|
pub created_at: DateTime<Utc>,
|
|
}
|
|
|
|
/// A user's favorite bookmark for a media item.
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct Favorite {
|
|
pub user_id: UserId,
|
|
pub media_id: MediaId,
|
|
pub created_at: DateTime<Utc>,
|
|
}
|
|
|
|
/// A shareable link to a media item with optional password and expiration.
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ShareLink {
|
|
pub id: Uuid,
|
|
pub media_id: MediaId,
|
|
pub created_by: UserId,
|
|
pub token: String,
|
|
#[serde(skip_serializing)]
|
|
pub password_hash: Option<String>,
|
|
pub expires_at: Option<DateTime<Utc>>,
|
|
pub view_count: u64,
|
|
pub created_at: DateTime<Utc>,
|
|
}
|