refactor: move shared servarr types into servarr_models
SystemStatus was declared three times, byte for byte identically, in radarr_models, sonarr_models, and lidarr_models. MetadataProfile and the Lidarr release download body were each declared in a single servarr module despite having nothing servarr specific about them: MetadataProfile is an id and name pair structurally identical to QualityProfile, which already lives in servarr_models, and a download body of a guid plus an indexer id is the generic form of that request. Move all three into servarr_models, preserving that file's alphabetical ordering, and drop the prefix from LidarrReleaseDownloadBody now that it is no longer owned by one servarr. RadarrReleaseDownloadBody and SonarrReleaseDownloadBody deliberately stay where they are. Radarr's carries a movie id and Sonarr's carries optional series, episode, and season fields, so the three types are not interchangeable and only the Lidarr shape is the common one. Behavior is unchanged. Every remaining edit is an import path update or the rename at a call site.
This commit is contained in:
24 files changed
+101
-107
No files matched your search
@@ -284,10 +284,8 @@ mod tests {
|
||||
use crate::cli::lidarr::manual_search_command_handler::LidarrManualSearchCommand;
|
||||
use crate::cli::lidarr::refresh_command_handler::LidarrRefreshCommand;
|
||||
use crate::cli::lidarr::trigger_automatic_search_command_handler::LidarrTriggerAutomaticSearchCommand;
|
||||
use crate::models::lidarr_models::{
|
||||
BlocklistItem, BlocklistResponse, LidarrReleaseDownloadBody, LidarrTaskName,
|
||||
};
|
||||
use crate::models::servarr_models::IndexerSettings;
|
||||
use crate::models::lidarr_models::{BlocklistItem, BlocklistResponse, LidarrTaskName};
|
||||
use crate::models::servarr_models::{IndexerSettings, ReleaseDownloadBody};
|
||||
use crate::{
|
||||
app::App,
|
||||
cli::{
|
||||
@@ -583,7 +581,7 @@ mod tests {
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_download_release_command() {
|
||||
let expected_release_download_body = LidarrReleaseDownloadBody {
|
||||
let expected_release_download_body = ReleaseDownloadBody {
|
||||
guid: "guid".to_owned(),
|
||||
indexer_id: 1,
|
||||
};
|
||||
|
||||
@@ -18,7 +18,8 @@ use super::{CliCommandHandler, Command};
|
||||
use crate::cli::lidarr::manual_search_command_handler::{
|
||||
LidarrManualSearchCommand, LidarrManualSearchCommandHandler,
|
||||
};
|
||||
use crate::models::lidarr_models::{LidarrReleaseDownloadBody, LidarrTaskName};
|
||||
use crate::models::lidarr_models::LidarrTaskName;
|
||||
use crate::models::servarr_models::ReleaseDownloadBody;
|
||||
use crate::network::lidarr_network::LidarrEvent;
|
||||
use crate::{app::App, network::NetworkTrait};
|
||||
|
||||
@@ -231,7 +232,7 @@ impl<'a, 'b> CliCommandHandler<'a, 'b, LidarrCommand> for LidarrCliHandler<'a, '
|
||||
serde_json::to_string_pretty(&resp)?
|
||||
}
|
||||
LidarrCommand::DownloadRelease { guid, indexer_id } => {
|
||||
let params = LidarrReleaseDownloadBody { guid, indexer_id };
|
||||
let params = ReleaseDownloadBody { guid, indexer_id };
|
||||
let resp = self
|
||||
.network
|
||||
.handle_network_event(LidarrEvent::DownloadRelease(params).into())
|
||||
|
||||
Reference in new issue
Block a user