fix(sonarr): Construct and pass the AddRootFolderBody alongside all AddRootFolder events when publishing to the networking channel

This commit is contained in:
2024-12-17 21:48:52 -07:00
parent 43410fac60
commit 23971cbb76
7 changed files with 351 additions and 73 deletions
+4 -3
View File
@@ -4,6 +4,8 @@ use anyhow::Result;
use clap::{ArgAction, Subcommand};
use tokio::sync::Mutex;
use super::SonarrCommand;
use crate::models::servarr_models::AddRootFolderBody;
use crate::{
app::App,
cli::{CliCommandHandler, Command},
@@ -11,8 +13,6 @@ use crate::{
network::{sonarr_network::SonarrEvent, NetworkTrait},
};
use super::SonarrCommand;
#[cfg(test)]
#[path = "add_command_handler_tests.rs"]
mod add_command_handler_tests;
@@ -153,9 +153,10 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, SonarrAddCommand> for SonarrAddCommandHan
serde_json::to_string_pretty(&resp)?
}
SonarrAddCommand::RootFolder { root_folder_path } => {
let add_root_folder_body = AddRootFolderBody { path: root_folder_path };
let resp = self
.network
.handle_network_event(SonarrEvent::AddRootFolder(Some(root_folder_path)).into())
.handle_network_event(SonarrEvent::AddRootFolder(add_root_folder_body).into())
.await?;
serde_json::to_string_pretty(&resp)?
}