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:
Dark-Alex-17 committed 2026-08-20 10:52:05 -06:00
1 parent a362add8f0
commit 4db9b92146
24 files changed
+101 -107

No files matched your search

@@ -5,10 +5,9 @@ use crate::handlers::table_handler::{TableHandlingConfig, handle_table};
use crate::handlers::{KeyEventHandler, handle_prompt_toggle};
use crate::matches_key;
use crate::models::Route;
use crate::models::lidarr_models::{
LidarrHistoryItem, LidarrRelease, LidarrReleaseDownloadBody, Track,
};
use crate::models::lidarr_models::{LidarrHistoryItem, LidarrRelease, Track};
use crate::models::servarr_data::lidarr::lidarr_data::{ALBUM_DETAILS_BLOCKS, ActiveLidarrBlock};
use crate::models::servarr_models::ReleaseDownloadBody;
use crate::models::stateful_table::SortOption;
use crate::network::lidarr_network::LidarrEvent;
use serde_json::Number;
@@ -281,7 +280,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveLidarrBlock> for AlbumDetailsHandler<
.unwrap()
.album_releases
.current_selection();
let params = LidarrReleaseDownloadBody {
let params = ReleaseDownloadBody {
guid: guid.clone(),
indexer_id: *indexer_id,
};
@@ -386,7 +385,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveLidarrBlock> for AlbumDetailsHandler<
.unwrap()
.album_releases
.current_selection();
let params = LidarrReleaseDownloadBody {
let params = ReleaseDownloadBody {
guid: guid.clone(),
indexer_id: *indexer_id,
};
@@ -9,10 +9,10 @@ mod tests {
AlbumDetailsHandler, releases_sorting_options,
};
use crate::models::HorizontallyScrollableText;
use crate::models::lidarr_models::{LidarrRelease, LidarrReleaseDownloadBody};
use crate::models::lidarr_models::LidarrRelease;
use crate::models::servarr_data::lidarr::lidarr_data::{ALBUM_DETAILS_BLOCKS, ActiveLidarrBlock};
use crate::models::servarr_data::lidarr::modals::AlbumDetailsModal;
use crate::models::servarr_models::{Quality, QualityWrapper};
use crate::models::servarr_models::{Quality, QualityWrapper, ReleaseDownloadBody};
use pretty_assertions::{assert_eq, assert_str_eq};
use rstest::rstest;
use serde_json::Number;
@@ -297,7 +297,7 @@ mod tests {
assert_navigation_popped!(app, ActiveLidarrBlock::ManualAlbumSearch.into());
assert_some_eq_x!(
&app.data.lidarr_data.prompt_confirm_action,
&LidarrEvent::DownloadRelease(LidarrReleaseDownloadBody {
&LidarrEvent::DownloadRelease(ReleaseDownloadBody {
guid: "1234".to_owned(),
indexer_id: 2,
})
@@ -654,7 +654,7 @@ mod tests {
assert_navigation_popped!(app, ActiveLidarrBlock::ManualAlbumSearch.into());
assert_some_eq_x!(
&app.data.lidarr_data.prompt_confirm_action,
&LidarrEvent::DownloadRelease(LidarrReleaseDownloadBody {
&LidarrEvent::DownloadRelease(ReleaseDownloadBody {
guid: "1234".to_owned(),
indexer_id: 2,
})
@@ -4,13 +4,12 @@ use crate::handlers::lidarr_handlers::history::history_sorting_options;
use crate::handlers::table_handler::{TableHandlingConfig, handle_table};
use crate::handlers::{KeyEventHandler, handle_prompt_toggle};
use crate::matches_key;
use crate::models::lidarr_models::{
Album, LidarrHistoryItem, LidarrRelease, LidarrReleaseDownloadBody,
};
use crate::models::lidarr_models::{Album, LidarrHistoryItem, LidarrRelease};
use crate::models::servarr_data::lidarr::lidarr_data::{
ARTIST_DETAILS_BLOCKS, ActiveLidarrBlock, DELETE_ALBUM_SELECTION_BLOCKS,
EDIT_ARTIST_SELECTION_BLOCKS,
};
use crate::models::servarr_models::ReleaseDownloadBody;
use crate::models::stateful_table::SortOption;
use crate::models::{BlockSelectionState, Route};
use crate::network::lidarr_network::LidarrEvent;
@@ -202,7 +201,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveLidarrBlock> for ArtistDetailsHandler
.discography_releases
.current_selection()
.clone();
let params = LidarrReleaseDownloadBody { guid, indexer_id };
let params = ReleaseDownloadBody { guid, indexer_id };
self.app.data.lidarr_data.prompt_confirm_action =
Some(LidarrEvent::DownloadRelease(params));
}
@@ -365,7 +364,7 @@ impl<'a, 'b> KeyEventHandler<'a, 'b, ActiveLidarrBlock> for ArtistDetailsHandler
.discography_releases
.current_selection()
.clone();
let params = LidarrReleaseDownloadBody { guid, indexer_id };
let params = ReleaseDownloadBody { guid, indexer_id };
self.app.data.lidarr_data.prompt_confirm_action =
Some(LidarrEvent::DownloadRelease(params));
@@ -137,8 +137,9 @@ mod tests {
use crate::event::Key;
use crate::handlers::KeyEventHandler;
use crate::handlers::lidarr_handlers::library::artist_details_handler::ArtistDetailsHandler;
use crate::models::lidarr_models::{LidarrHistoryItem, LidarrReleaseDownloadBody};
use crate::models::lidarr_models::LidarrHistoryItem;
use crate::models::servarr_data::lidarr::lidarr_data::ActiveLidarrBlock;
use crate::models::servarr_models::ReleaseDownloadBody;
use crate::network::lidarr_network::LidarrEvent;
use crate::network::lidarr_network::lidarr_network_test_utils::test_utils::{
artist, torrent_release,
@@ -307,7 +308,7 @@ mod tests {
assert_navigation_popped!(app, ActiveLidarrBlock::ManualArtistSearch.into());
assert_eq!(
app.data.lidarr_data.prompt_confirm_action,
Some(LidarrEvent::DownloadRelease(LidarrReleaseDownloadBody {
Some(LidarrEvent::DownloadRelease(ReleaseDownloadBody {
guid: release.guid,
indexer_id: release.indexer_id,
}))
@@ -449,10 +450,11 @@ mod tests {
use crate::assert_navigation_pushed;
use crate::handlers::KeyEventHandler;
use crate::handlers::lidarr_handlers::library::artist_details_handler::ArtistDetailsHandler;
use crate::models::lidarr_models::{Artist, LidarrReleaseDownloadBody};
use crate::models::lidarr_models::Artist;
use crate::models::servarr_data::lidarr::lidarr_data::{
ActiveLidarrBlock, EDIT_ARTIST_SELECTION_BLOCKS,
};
use crate::models::servarr_models::ReleaseDownloadBody;
use crate::network::lidarr_network::LidarrEvent;
use crate::network::lidarr_network::lidarr_network_test_utils::test_utils::torrent_release;
use crate::{assert_modal_absent, assert_modal_present, assert_navigation_popped};
@@ -801,7 +803,7 @@ mod tests {
assert_navigation_popped!(app, ActiveLidarrBlock::ManualArtistSearch.into());
assert_eq!(
app.data.lidarr_data.prompt_confirm_action,
Some(LidarrEvent::DownloadRelease(LidarrReleaseDownloadBody {
Some(LidarrEvent::DownloadRelease(ReleaseDownloadBody {
guid: release.guid,
indexer_id: release.indexer_id,
}))