Clean up output

This commit is contained in:
Marc Plano-Lesay 2025-05-01 16:08:49 +10:00
parent 774a5ed4ac
commit 1a11a18d05
Signed by: kernald
GPG key ID: 66A41B08CC62A6CF
7 changed files with 224 additions and 77 deletions

22
src/actions/action.rs Normal file
View file

@ -0,0 +1,22 @@
use crate::models::Magnet;
use async_trait::async_trait;
use color_eyre::eyre::Result;
/// Struct to hold the list of processed and failed magnets
pub struct ProcessedMagnets {
pub success: Vec<Magnet>,
pub failed: Vec<Magnet>,
}
/// Trait for actions that process magnet links
#[async_trait]
pub trait Action {
/// Return the name of the action
fn name(&self) -> &str;
/// Process all unprocessed magnet links and return the list of processed magnets
async fn process_unprocessed_magnets(
&mut self,
db: &mut crate::db::Database,
) -> Result<ProcessedMagnets>;
}