refactor: Refactored the IndexerTestResut model into the general Servarr models

This commit is contained in:
2025-08-12 17:05:17 -06:00
parent 20ea15009d
commit e2a6af1cbd
7 changed files with 29 additions and 30 deletions
+1 -17
View File
@@ -1,5 +1,6 @@
use std::fmt::{Display, Formatter};
use crate::models::servarr_models::IndexerTestResult;
use crate::{models::HorizontallyScrollableText, serde_enum_from};
use chrono::{DateTime, Utc};
use clap::ValueEnum;
@@ -216,23 +217,6 @@ pub struct IndexerSettings {
pub whitelisted_hardcoded_subs: HorizontallyScrollableText,
}
#[derive(Default, Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct IndexerTestResult {
#[serde(deserialize_with = "super::from_i64")]
pub id: i64,
pub is_valid: bool,
pub validation_failures: Vec<IndexerValidationFailure>,
}
#[derive(Default, Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct IndexerValidationFailure {
pub property_name: String,
pub error_message: String,
pub severity: String,
}
#[derive(Serialize, Deserialize, Derivative, Debug, Clone, PartialEq, Eq)]
#[derivative(Default)]
#[serde(rename_all = "camelCase")]
+17
View File
@@ -153,6 +153,23 @@ pub struct Indexer {
pub tags: Vec<Number>,
}
#[derive(Default, Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct IndexerTestResult {
#[serde(deserialize_with = "super::from_i64")]
pub id: i64,
pub is_valid: bool,
pub validation_failures: Vec<IndexerValidationFailure>,
}
#[derive(Default, Serialize, Deserialize, Debug, Clone, PartialEq, Eq)]
#[serde(rename_all = "camelCase")]
pub struct IndexerValidationFailure {
pub property_name: String,
pub error_message: String,
pub severity: String,
}
#[derive(Default, Deserialize, Serialize, Debug, Clone, Eq, PartialEq)]
pub struct IndexerField {
pub name: Option<String>,
+1 -2
View File
@@ -1,6 +1,6 @@
use std::fmt::{Display, Formatter};
use crate::serde_enum_from;
use crate::{models::servarr_models::IndexerTestResult, serde_enum_from};
use chrono::{DateTime, Utc};
use clap::ValueEnum;
use derivative::Derivative;
@@ -11,7 +11,6 @@ use strum::EnumIter;
use strum_macros::Display;
use super::{
radarr_models::IndexerTestResult,
servarr_models::{
DiskSpace, HostConfig, Indexer, Language, LogResponse, QualityProfile, QualityWrapper,
QueueEvent, RootFolder, SecurityConfig, Tag, Update,
+2 -3
View File
@@ -4,10 +4,9 @@ mod tests {
use serde_json::json;
use crate::models::{
radarr_models::IndexerTestResult,
servarr_models::{
DiskSpace, HostConfig, Indexer, Language, Log, LogResponse, QualityProfile, QueueEvent,
RootFolder, SecurityConfig, Tag, Update,
DiskSpace, HostConfig, Indexer, IndexerTestResult, Language, Log, LogResponse,
QualityProfile, QueueEvent, RootFolder, SecurityConfig, Tag, Update,
},
sonarr_models::{
AddSeriesSearchResult, BlocklistItem, BlocklistResponse, DownloadRecord, DownloadStatus,