From bd8fe8eb32dc6550d23bd2840b37797e7fc70c48 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 15 Oct 2023 15:29:20 -0500 Subject: move transfer retention options --- src/slskd/Application.cs | 12 ++++---- src/slskd/Core/Options.cs | 76 +++++++++++++++++++++++++++-------------------- 2 files changed, 50 insertions(+), 38 deletions(-) (limited to 'src') diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs index 6d6ccd37..89ff6b27 100644 --- a/src/slskd/Application.cs +++ b/src/slskd/Application.cs @@ -821,13 +821,13 @@ namespace slskd try { - PruneUpload(options.Upload.Succeeded, TransferStates.Succeeded); - PruneUpload(options.Upload.Cancelled, TransferStates.Cancelled); - PruneUpload(options.Upload.Errored, TransferStates.Errored); + PruneUpload(options.Transfers.Upload.Succeeded, TransferStates.Succeeded); + PruneUpload(options.Transfers.Upload.Cancelled, TransferStates.Cancelled); + PruneUpload(options.Transfers.Upload.Errored, TransferStates.Errored); - PruneDownload(options.Download.Succeeded, TransferStates.Succeeded); - PruneDownload(options.Download.Cancelled, TransferStates.Cancelled); - PruneDownload(options.Download.Errored, TransferStates.Errored); + PruneDownload(options.Transfers.Download.Succeeded, TransferStates.Succeeded); + PruneDownload(options.Transfers.Download.Cancelled, TransferStates.Cancelled); + PruneDownload(options.Transfers.Download.Errored, TransferStates.Errored); } catch { diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index 9d92bb95..2b9c3455 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -1060,22 +1060,16 @@ namespace slskd public class RetentionOptions { /// - /// Gets file retention options. - /// - [Validate] - public FileRetentionOptions Files { get; init; } = new FileRetentionOptions(); - - /// - /// Gets upload retention options. + /// Gets transfer retention options. /// [Validate] - public TransferRetentionOptions Upload { get; init; } = new TransferRetentionOptions(); + public TransferRetentionOptions Transfers { get; init; } = new TransferRetentionOptions(); /// - /// Gets download retention options. + /// Gets file retention options. /// [Validate] - public TransferRetentionOptions Download { get; init; } = new TransferRetentionOptions(); + public FileRetentionOptions Files { get; init; } = new FileRetentionOptions(); /// /// Gets the time to retain logs, in days. @@ -1084,45 +1078,63 @@ namespace slskd public int Logs { get; init; } = 180; /// - /// File retention options. + /// Transfer retention options. /// - public class FileRetentionOptions + public class TransferRetentionOptions { /// - /// Gets the time to retain completed files, in minutes. + /// Gets upload retention options. /// - [Range(30, maximum: int.MaxValue)] - public int? Complete { get; init; } = null; + [Validate] + public TransferTypeRetentionOptions Upload { get; init; } = new TransferTypeRetentionOptions(); /// - /// Gets the time to retain incomplete files, in minutes. + /// Gets download retention options. /// - [Range(30, maximum: int.MaxValue)] - public int? Incomplete { get; init; } = null; + [Validate] + public TransferTypeRetentionOptions Download { get; init; } = new TransferTypeRetentionOptions(); + + /// + /// Transfer retention options. + /// + public class TransferTypeRetentionOptions + { + /// + /// Gets the time to retain successful transfers, in minutes. + /// + [Range(5, maximum: int.MaxValue)] + public int? Succeeded { get; init; } = null; + + /// + /// Gets the time to retain errored transfers, in minutes. + /// + [Range(5, maximum: int.MaxValue)] + public int? Errored { get; init; } = null; + + /// + /// Gets the time to retain cancelled transfers, in minutes. + /// + [Range(5, maximum: int.MaxValue)] + public int? Cancelled { get; init; } = null; + } } /// - /// Transfer retention options. + /// File retention options. /// - public class TransferRetentionOptions + public class FileRetentionOptions { /// - /// Gets the time to retain successful transfers, in minutes. - /// - [Range(5, maximum: int.MaxValue)] - public int? Succeeded { get; init; } = null; - - /// - /// Gets the time to retain errored transfers, in minutes. + /// Gets the time to retain completed files, in minutes. /// - [Range(5, maximum: int.MaxValue)] - public int? Errored { get; init; } = null; + [Range(30, maximum: int.MaxValue)] + public int? Complete { get; init; } = null; /// - /// Gets the time to retain cancelled transfers, in minutes. + /// Gets the time to retain incomplete files, in minutes. /// - [Range(5, maximum: int.MaxValue)] - public int? Cancelled { get; init; } = null; + [Range(30, maximum: int.MaxValue)] + public int? Incomplete { get; init; } = null; } } -- cgit v1.2.3