chore: bump deps; fix clippy lints & cleanup

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I4c4815ad145650a07f108614034d2e996a6a6964
This commit is contained in:
raf 2026-03-02 17:05:28 +03:00
commit cd1161ee5d
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
41 changed files with 1528 additions and 953 deletions

View file

@ -6,10 +6,12 @@ use uuid::Uuid;
use crate::media_type::MediaType;
/// Unique identifier for a media item.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct MediaId(pub Uuid);
impl MediaId {
/// Creates a new media ID using UUIDv7.
pub fn new() -> Self {
Self(Uuid::now_v7())
}
@ -27,10 +29,12 @@ impl Default for MediaId {
}
}
/// BLAKE3 content hash for deduplication.
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct ContentHash(pub String);
impl ContentHash {
/// Creates a new content hash from a hex string.
pub fn new(hex: String) -> Self {
Self(hex)
}
@ -42,8 +46,6 @@ impl fmt::Display for ContentHash {
}
}
// ===== Managed Storage Types =====
/// Storage mode for media items
#[derive(
Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize,
@ -162,12 +164,14 @@ pub struct MediaItem {
pub links_extracted_at: Option<DateTime<Utc>>,
}
/// A custom field attached to a media item.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CustomField {
pub field_type: CustomFieldType,
pub value: String,
}
/// Type of custom field value.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum CustomFieldType {
@ -177,6 +181,7 @@ pub enum CustomFieldType {
Boolean,
}
/// A tag that can be applied to media items.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Tag {
pub id: Uuid,
@ -185,6 +190,7 @@ pub struct Tag {
pub created_at: DateTime<Utc>,
}
/// A collection of media items.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Collection {
pub id: Uuid,
@ -196,6 +202,7 @@ pub struct Collection {
pub updated_at: DateTime<Utc>,
}
/// Kind of collection.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum CollectionKind {
@ -203,6 +210,7 @@ pub enum CollectionKind {
Virtual,
}
/// A member of a collection with position tracking.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CollectionMember {
pub collection_id: Uuid,
@ -211,6 +219,7 @@ pub struct CollectionMember {
pub added_at: DateTime<Utc>,
}
/// An audit trail entry.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AuditEntry {
pub id: Uuid,
@ -329,6 +338,7 @@ impl fmt::Display for AuditAction {
}
}
/// Pagination parameters for list queries.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Pagination {
pub offset: u64,
@ -337,6 +347,7 @@ pub struct Pagination {
}
impl Pagination {
/// Creates a new pagination instance.
pub fn new(offset: u64, limit: u64, sort: Option<String>) -> Self {
Self {
offset,
@ -356,6 +367,7 @@ impl Default for Pagination {
}
}
/// A saved search query.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct SavedSearch {
pub id: Uuid,
@ -367,6 +379,7 @@ pub struct SavedSearch {
// Book Management Types
/// Metadata for book-type media.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BookMetadata {
pub media_id: MediaId,
@ -385,6 +398,7 @@ pub struct BookMetadata {
pub updated_at: DateTime<Utc>,
}
/// Information about a book author.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct AuthorInfo {
pub name: String,
@ -394,6 +408,7 @@ pub struct AuthorInfo {
}
impl AuthorInfo {
/// Creates a new author with the given name.
pub fn new(name: String) -> Self {
Self {
name,
@ -403,6 +418,7 @@ impl AuthorInfo {
}
}
/// Sets the author's role.
pub fn with_role(mut self, role: String) -> Self {
self.role = role;
self
@ -435,6 +451,7 @@ pub struct ExtractedBookMetadata {
pub identifiers: HashMap<String, Vec<String>>,
}
/// Reading progress for a book.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ReadingProgress {
pub media_id: MediaId,
@ -446,6 +463,7 @@ pub struct ReadingProgress {
}
impl ReadingProgress {
/// Creates a new reading progress entry.
pub fn new(
media_id: MediaId,
user_id: Uuid,
@ -473,6 +491,7 @@ impl ReadingProgress {
}
}
/// Reading status for a book.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum ReadingStatus {
@ -493,8 +512,6 @@ impl fmt::Display for ReadingStatus {
}
}
// ===== Markdown Links (Obsidian-style) =====
/// Type of markdown link
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
@ -530,7 +547,7 @@ impl std::str::FromStr for LinkType {
}
}
/// A markdown link extracted from a file
/// A markdown link extracted from a file.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MarkdownLink {
pub id: Uuid,
@ -549,7 +566,7 @@ pub struct MarkdownLink {
pub created_at: DateTime<Utc>,
}
/// Information about a backlink (incoming link)
/// Information about a backlink (incoming link).
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BacklinkInfo {
pub link_id: Uuid,
@ -562,14 +579,14 @@ pub struct BacklinkInfo {
pub link_type: LinkType,
}
/// Graph data for visualization
/// Graph data for visualization.
#[derive(Debug, Clone, Default, Serialize, Deserialize)]
pub struct GraphData {
pub nodes: Vec<GraphNode>,
pub edges: Vec<GraphEdge>,
}
/// A node in the graph visualization
/// A node in the graph visualization.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GraphNode {
pub id: String,
@ -582,7 +599,7 @@ pub struct GraphNode {
pub backlink_count: u32,
}
/// An edge (link) in the graph visualization
/// An edge (link) in the graph visualization.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct GraphEdge {
pub source: String,