feat(network): Support to fetch all Sonarr history events

This commit is contained in:
2024-11-20 14:06:44 -07:00
parent b8c60bf59a
commit 6da1ae93ef
5 changed files with 392 additions and 5 deletions
@@ -6,7 +6,6 @@ use crate::models::{
servarr_models::{Indexer, QueueEvent},
sonarr_models::{
BlocklistItem, DownloadRecord, IndexerSettings, Season, Series, SonarrHistoryItem,
SonarrHistoryWrapper,
},
stateful_list::StatefulList,
stateful_table::StatefulTable,
@@ -22,7 +21,7 @@ mod sonarr_data_tests;
pub struct SonarrData {
pub blocklist: StatefulTable<BlocklistItem>,
pub downloads: StatefulTable<DownloadRecord>,
pub history: StatefulTable<SonarrHistoryWrapper>,
pub history: StatefulTable<SonarrHistoryItem>,
pub indexers: StatefulTable<Indexer>,
pub indexer_settings: Option<IndexerSettings>,
pub logs: StatefulList<HorizontallyScrollableText>,
+2
View File
@@ -349,6 +349,7 @@ pub enum SonarrSerdeable {
SecurityConfig(SecurityConfig),
SeriesVec(Vec<Series>),
Series(Series),
SonarrHistoryWrapper(SonarrHistoryWrapper),
SystemStatus(SystemStatus),
BlocklistResponse(BlocklistResponse),
LogResponse(LogResponse),
@@ -381,6 +382,7 @@ serde_enum_from!(
SecurityConfig(SecurityConfig),
SeriesVec(Vec<Series>),
Series(Series),
SonarrHistoryWrapper(SonarrHistoryWrapper),
SystemStatus(SystemStatus),
BlocklistResponse(BlocklistResponse),
LogResponse(LogResponse),
+18 -1
View File
@@ -9,7 +9,8 @@ mod tests {
},
sonarr_models::{
BlocklistItem, BlocklistResponse, DownloadRecord, DownloadsResponse, Episode,
IndexerSettings, Series, SeriesStatus, SeriesType, SonarrSerdeable, SystemStatus,
IndexerSettings, Series, SeriesStatus, SeriesType, SonarrHistoryItem, SonarrHistoryWrapper,
SonarrSerdeable, SystemStatus,
},
Serdeable,
};
@@ -167,6 +168,22 @@ mod tests {
assert_eq!(sonarr_serdeable, SonarrSerdeable::Series(series));
}
#[test]
fn test_sonarr_serdeable_from_sonarr_history_wrapper() {
let history_wrapper = SonarrHistoryWrapper {
records: vec![SonarrHistoryItem {
id: 1,
..SonarrHistoryItem::default()
}],
};
let sonarr_serdeable: SonarrSerdeable = history_wrapper.clone().into();
assert_eq!(
sonarr_serdeable,
SonarrSerdeable::SonarrHistoryWrapper(history_wrapper)
);
}
#[test]
fn test_sonarr_serdeable_from_system_status() {
let system_status = SystemStatus {