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 1283 additions and 740 deletions

View file

@ -142,29 +142,13 @@ pub trait StorageBackend: Send + Sync + 'static {
) -> Result<()>;
// Batch operations (transactional where supported)
async fn batch_delete_media(&self, ids: &[MediaId]) -> Result<u64> {
let mut count = 0u64;
for id in ids {
self.delete_media(*id).await?;
count += 1;
}
Ok(count)
}
async fn batch_delete_media(&self, ids: &[MediaId]) -> Result<u64>;
async fn batch_tag_media(
&self,
media_ids: &[MediaId],
tag_ids: &[Uuid],
) -> Result<u64> {
let mut count = 0u64;
for media_id in media_ids {
for tag_id in tag_ids {
self.tag_media(*media_id, *tag_id).await?;
count += 1;
}
}
Ok(count)
}
) -> Result<u64>;
// Integrity
async fn list_media_paths(
@ -342,7 +326,6 @@ pub trait StorageBackend: Send + Sync + 'static {
}
}
// ===== Ratings =====
async fn rate_media(
&self,
user_id: UserId,
@ -358,7 +341,6 @@ pub trait StorageBackend: Send + Sync + 'static {
) -> Result<Option<Rating>>;
async fn delete_rating(&self, id: Uuid) -> Result<()>;
// ===== Comments =====
async fn add_comment(
&self,
user_id: UserId,
@ -370,7 +352,6 @@ pub trait StorageBackend: Send + Sync + 'static {
-> Result<Vec<Comment>>;
async fn delete_comment(&self, id: Uuid) -> Result<()>;
// ===== Favorites =====
async fn add_favorite(
&self,
user_id: UserId,
@ -392,7 +373,6 @@ pub trait StorageBackend: Send + Sync + 'static {
media_id: MediaId,
) -> Result<bool>;
// ===== Share Links =====
async fn create_share_link(
&self,
media_id: MediaId,
@ -405,7 +385,6 @@ pub trait StorageBackend: Send + Sync + 'static {
async fn increment_share_views(&self, token: &str) -> Result<()>;
async fn delete_share_link(&self, id: Uuid) -> Result<()>;
// ===== Playlists =====
async fn create_playlist(
&self,
owner_id: UserId,
@ -450,7 +429,6 @@ pub trait StorageBackend: Send + Sync + 'static {
new_position: i32,
) -> Result<()>;
// ===== Analytics =====
async fn record_usage_event(&self, event: &UsageEvent) -> Result<()>;
async fn get_usage_events(
&self,
@ -477,7 +455,6 @@ pub trait StorageBackend: Send + Sync + 'static {
) -> Result<Option<f64>>;
async fn cleanup_old_events(&self, before: DateTime<Utc>) -> Result<u64>;
// ===== Subtitles =====
async fn add_subtitle(&self, subtitle: &Subtitle) -> Result<()>;
async fn get_media_subtitles(
&self,
@ -490,7 +467,6 @@ pub trait StorageBackend: Send + Sync + 'static {
offset_ms: i64,
) -> Result<()>;
// ===== External Metadata (Enrichment) =====
async fn store_external_metadata(
&self,
meta: &ExternalMetadata,
@ -501,7 +477,6 @@ pub trait StorageBackend: Send + Sync + 'static {
) -> Result<Vec<ExternalMetadata>>;
async fn delete_external_metadata(&self, id: Uuid) -> Result<()>;
// ===== Transcode Sessions =====
async fn create_transcode_session(
&self,
session: &TranscodeSession,
@ -522,7 +497,6 @@ pub trait StorageBackend: Send + Sync + 'static {
before: DateTime<Utc>,
) -> Result<u64>;
// ===== Session Management =====
/// Create a new session in the database
async fn create_session(&self, session: &SessionData) -> Result<()>;
@ -623,8 +597,6 @@ pub trait StorageBackend: Send + Sync + 'static {
pagination: &Pagination,
) -> Result<Vec<MediaItem>>;
// ===== Managed Storage =====
/// Insert a media item that uses managed storage
async fn insert_managed_media(&self, item: &MediaItem) -> Result<()>;
@ -658,8 +630,6 @@ pub trait StorageBackend: Send + Sync + 'static {
/// Get managed storage statistics
async fn managed_storage_stats(&self) -> Result<ManagedStorageStats>;
// ===== Sync Devices =====
/// Register a new sync device
async fn register_device(
&self,
@ -695,8 +665,6 @@ pub trait StorageBackend: Send + Sync + 'static {
/// Update the last_seen_at timestamp for a device
async fn touch_device(&self, id: crate::sync::DeviceId) -> Result<()>;
// ===== Sync Log =====
/// Record a change in the sync log
async fn record_sync_change(
&self,
@ -716,8 +684,6 @@ pub trait StorageBackend: Send + Sync + 'static {
/// Clean up old sync log entries
async fn cleanup_old_sync_log(&self, before: DateTime<Utc>) -> Result<u64>;
// ===== Device Sync State =====
/// Get sync state for a device and path
async fn get_device_sync_state(
&self,
@ -737,8 +703,6 @@ pub trait StorageBackend: Send + Sync + 'static {
device_id: crate::sync::DeviceId,
) -> Result<Vec<crate::sync::DeviceSyncState>>;
// ===== Upload Sessions (Chunked Uploads) =====
/// Create a new upload session
async fn create_upload_session(
&self,
@ -773,8 +737,6 @@ pub trait StorageBackend: Send + Sync + 'static {
/// Clean up expired upload sessions
async fn cleanup_expired_uploads(&self) -> Result<u64>;
// ===== Sync Conflicts =====
/// Record a sync conflict
async fn record_conflict(
&self,
@ -794,8 +756,6 @@ pub trait StorageBackend: Send + Sync + 'static {
resolution: crate::config::ConflictResolution,
) -> Result<()>;
// ===== Enhanced Sharing =====
/// Create a new share
async fn create_share(
&self,
@ -872,8 +832,6 @@ pub trait StorageBackend: Send + Sync + 'static {
/// Clean up expired shares
async fn cleanup_expired_shares(&self) -> Result<u64>;
// ===== Share Activity =====
/// Record share activity
async fn record_share_activity(
&self,
@ -887,8 +845,6 @@ pub trait StorageBackend: Send + Sync + 'static {
pagination: &Pagination,
) -> Result<Vec<crate::sharing::ShareActivity>>;
// ===== Share Notifications =====
/// Create a share notification
async fn create_share_notification(
&self,
@ -907,8 +863,6 @@ pub trait StorageBackend: Send + Sync + 'static {
/// Mark all notifications as read for a user
async fn mark_all_notifications_read(&self, user_id: UserId) -> Result<()>;
// ===== File Management =====
/// Rename a media item (changes file_name and updates path accordingly).
/// For external storage, this actually renames the file on disk.
/// For managed storage, this only updates the metadata.
@ -939,8 +893,6 @@ pub trait StorageBackend: Send + Sync + 'static {
Ok(results)
}
// ===== Trash / Soft Delete =====
/// Soft delete a media item (set deleted_at timestamp).
async fn soft_delete_media(&self, id: MediaId) -> Result<()>;
@ -960,8 +912,6 @@ pub trait StorageBackend: Send + Sync + 'static {
/// Count items in trash.
async fn count_trash(&self) -> Result<u64>;
// ===== Markdown Links (Obsidian-style) =====
/// Save extracted markdown links for a media item.
/// This replaces any existing links for the source media.
async fn save_markdown_links(

View file

@ -583,8 +583,7 @@ impl StorageBackend for PostgresBackend {
crate::storage::migrations::run_postgres_migrations(client).await
}
// ---- Root directories ----
// Root directories
async fn add_root_dir(&self, path: PathBuf) -> Result<()> {
let client = self
.pool
@ -638,8 +637,7 @@ impl StorageBackend for PostgresBackend {
Ok(())
}
// ---- Media CRUD ----
// Media CRUD
async fn insert_media(&self, item: &MediaItem) -> Result<()> {
let client = self
.pool
@ -1032,8 +1030,7 @@ impl StorageBackend for PostgresBackend {
Ok(count as u64)
}
// ---- Batch Operations ----
// Batch Operations
async fn batch_delete_media(&self, ids: &[MediaId]) -> Result<u64> {
if ids.is_empty() {
return Ok(0);
@ -1089,8 +1086,7 @@ impl StorageBackend for PostgresBackend {
Ok(rows)
}
// ---- Tags ----
// Tags
async fn create_tag(
&self,
name: &str,
@ -1257,8 +1253,7 @@ impl StorageBackend for PostgresBackend {
rows.iter().map(row_to_tag).collect()
}
// ---- Collections ----
// Collections
async fn create_collection(
&self,
name: &str,
@ -1499,8 +1494,7 @@ impl StorageBackend for PostgresBackend {
Ok(items)
}
// ---- Search ----
// Search
async fn search(&self, request: &SearchRequest) -> Result<SearchResults> {
let client = self
.pool
@ -1666,8 +1660,7 @@ impl StorageBackend for PostgresBackend {
})
}
// ---- Audit ----
// Audit
async fn record_audit(&self, entry: &AuditEntry) -> Result<()> {
let client = self
.pool
@ -1739,8 +1732,7 @@ impl StorageBackend for PostgresBackend {
rows.iter().map(row_to_audit_entry).collect()
}
// ---- Custom fields ----
// Custom fields
async fn set_custom_field(
&self,
media_id: MediaId,
@ -1821,8 +1813,7 @@ impl StorageBackend for PostgresBackend {
Ok(())
}
// ---- Duplicates ----
// Duplicates
async fn find_duplicates(&self) -> Result<Vec<Vec<MediaItem>>> {
let client = self
.pool
@ -2007,8 +1998,7 @@ impl StorageBackend for PostgresBackend {
Ok(groups)
}
// ---- Database management ----
// Database management
async fn database_stats(&self) -> Result<crate::storage::DatabaseStats> {
let client = self
.pool
@ -2524,7 +2514,6 @@ impl StorageBackend for PostgresBackend {
Ok(())
}
// ===== Ratings =====
async fn rate_media(
&self,
user_id: crate::users::UserId,
@ -2635,7 +2624,6 @@ impl StorageBackend for PostgresBackend {
Ok(())
}
// ===== Comments =====
async fn add_comment(
&self,
user_id: crate::users::UserId,
@ -2712,7 +2700,6 @@ impl StorageBackend for PostgresBackend {
Ok(())
}
// ===== Favorites =====
async fn add_favorite(
&self,
user_id: crate::users::UserId,
@ -2838,7 +2825,6 @@ impl StorageBackend for PostgresBackend {
Ok(count > 0)
}
// ===== Share Links =====
async fn create_share_link(
&self,
media_id: MediaId,
@ -2942,7 +2928,6 @@ impl StorageBackend for PostgresBackend {
Ok(())
}
// ===== Playlists =====
async fn create_playlist(
&self,
owner_id: crate::users::UserId,
@ -3250,7 +3235,6 @@ impl StorageBackend for PostgresBackend {
Ok(())
}
// ===== Analytics =====
async fn record_usage_event(
&self,
event: &crate::analytics::UsageEvent,
@ -3540,7 +3524,6 @@ impl StorageBackend for PostgresBackend {
Ok(affected)
}
// ===== Subtitles =====
async fn add_subtitle(
&self,
subtitle: &crate::subtitles::Subtitle,
@ -3652,7 +3635,6 @@ impl StorageBackend for PostgresBackend {
Ok(())
}
// ===== External Metadata (Enrichment) =====
async fn store_external_metadata(
&self,
meta: &crate::enrichment::ExternalMetadata,
@ -3742,7 +3724,6 @@ impl StorageBackend for PostgresBackend {
Ok(())
}
// ===== Transcode Sessions =====
async fn create_transcode_session(
&self,
session: &crate::transcode::TranscodeSession,
@ -3930,8 +3911,6 @@ impl StorageBackend for PostgresBackend {
Ok(affected)
}
// ===== Session Management =====
async fn create_session(
&self,
session: &crate::storage::SessionData,
@ -4666,10 +4645,6 @@ impl StorageBackend for PostgresBackend {
items
}
// =========================================================================
// Managed Storage
// =========================================================================
async fn insert_managed_media(&self, item: &MediaItem) -> Result<()> {
let client = self.pool.get().await.map_err(|e| {
PinakesError::Database(format!("failed to get connection: {e}"))
@ -4967,10 +4942,6 @@ impl StorageBackend for PostgresBackend {
})
}
// =========================================================================
// Sync Devices
// =========================================================================
async fn register_device(
&self,
device: &crate::sync::SyncDevice,
@ -5188,10 +5159,6 @@ impl StorageBackend for PostgresBackend {
Ok(())
}
// =========================================================================
// Sync Log
// =========================================================================
async fn record_sync_change(
&self,
change: &crate::sync::SyncLogEntry,
@ -5310,10 +5277,6 @@ impl StorageBackend for PostgresBackend {
Ok(result)
}
// =========================================================================
// Device Sync State
// =========================================================================
async fn get_device_sync_state(
&self,
device_id: crate::sync::DeviceId,
@ -5437,10 +5400,6 @@ impl StorageBackend for PostgresBackend {
)
}
// =========================================================================
// Upload Sessions
// =========================================================================
async fn create_upload_session(
&self,
session: &crate::sync::UploadSession,
@ -5618,10 +5577,6 @@ impl StorageBackend for PostgresBackend {
Ok(result)
}
// =========================================================================
// Sync Conflicts
// =========================================================================
async fn record_conflict(
&self,
conflict: &crate::sync::SyncConflict,
@ -5737,10 +5692,6 @@ impl StorageBackend for PostgresBackend {
Ok(())
}
// =========================================================================
// Shares
// =========================================================================
async fn create_share(
&self,
share: &crate::sharing::Share,
@ -6050,10 +6001,10 @@ impl StorageBackend for PostgresBackend {
for share in shares {
// Skip expired shares
if let Some(exp) = share.expires_at {
if exp < now {
continue;
}
if let Some(exp) = share.expires_at
&& exp < now
{
continue;
}
match (&share.recipient, user_id) {
@ -6167,10 +6118,6 @@ impl StorageBackend for PostgresBackend {
Ok(result)
}
// =========================================================================
// Share Activity
// =========================================================================
async fn record_share_activity(
&self,
activity: &crate::sharing::ShareActivity,
@ -6244,10 +6191,6 @@ impl StorageBackend for PostgresBackend {
)
}
// =========================================================================
// Share Notifications
// =========================================================================
async fn create_share_notification(
&self,
notification: &crate::sharing::ShareNotification,
@ -6349,8 +6292,6 @@ impl StorageBackend for PostgresBackend {
Ok(())
}
// ===== File Management =====
async fn rename_media(&self, id: MediaId, new_name: &str) -> Result<String> {
// Validate the new name
if new_name.is_empty() || new_name.contains('/') || new_name.contains('\\')
@ -6468,8 +6409,6 @@ impl StorageBackend for PostgresBackend {
Ok(old_path)
}
// ===== Trash / Soft Delete =====
async fn soft_delete_media(&self, id: MediaId) -> Result<()> {
let client = self
.pool
@ -6671,8 +6610,6 @@ impl StorageBackend for PostgresBackend {
Ok(count as u64)
}
// ===== Markdown Links (Obsidian-style) =====
async fn save_markdown_links(
&self,
media_id: MediaId,

File diff suppressed because it is too large Load diff