2025-03-24 16:47:42 +01:00
|
|
|
use uuid::Uuid;
|
|
|
|
|
|
|
|
|
|
use crate::common::errors::Result;
|
2026-02-14 01:29:34 +01:00
|
|
|
use crate::domain::entities::trashed_item::TrashedItem;
|
2025-03-24 16:47:42 +01:00
|
|
|
|
|
|
|
|
pub trait TrashRepository: Send + Sync {
|
|
|
|
|
async fn add_to_trash(&self, item: &TrashedItem) -> Result<()>;
|
|
|
|
|
async fn get_trash_items(&self, user_id: &Uuid) -> Result<Vec<TrashedItem>>;
|
|
|
|
|
async fn get_trash_item(&self, id: &Uuid, user_id: &Uuid) -> Result<Option<TrashedItem>>;
|
|
|
|
|
async fn restore_from_trash(&self, id: &Uuid, user_id: &Uuid) -> Result<()>;
|
|
|
|
|
async fn delete_permanently(&self, id: &Uuid, user_id: &Uuid) -> Result<()>;
|
|
|
|
|
async fn clear_trash(&self, user_id: &Uuid) -> Result<()>;
|
2026-02-26 00:42:41 +01:00
|
|
|
|
2026-05-21 23:56:14 +02:00
|
|
|
/// All trashed file IDs for this user, regardless of parent folder trash status.
|
|
|
|
|
/// Used by empty_trash for thumbnail cleanup — the view used by get_trash_items
|
|
|
|
|
/// excludes files inside trashed folders, which would miss their ext thumbnails.
|
|
|
|
|
async fn get_all_trashed_file_ids(&self, user_id: &Uuid) -> Result<Vec<String>>;
|
|
|
|
|
|
2026-02-26 00:42:41 +01:00
|
|
|
/// Bulk-delete all expired trash items (files + folders) in a single
|
|
|
|
|
/// transaction. Returns `(files_deleted, folders_deleted)`.
|
|
|
|
|
async fn delete_expired_bulk(&self) -> Result<(u64, u64)>;
|
2026-02-14 01:29:34 +01:00
|
|
|
}
|