From c5c2597ef63a02f59d6f1872c3bed4f7e9336c0f Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 18 Oct 2026 15:42:46 -0500 Subject: use Query() within List() --- src/slskd/Transfers/Uploads/UploadService.cs | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/slskd/Transfers/Uploads/UploadService.cs b/src/slskd/Transfers/Uploads/UploadService.cs index c72c96ee..35bb9468 100644 --- a/src/slskd/Transfers/Uploads/UploadService.cs +++ b/src/slskd/Transfers/Uploads/UploadService.cs @@ -45,6 +45,7 @@ namespace slskd.Transfers.Uploads using System.Threading; using System.Threading.Tasks; using Microsoft.EntityFrameworkCore; + using Microsoft.EntityFrameworkCore.Query; using Serilog; using slskd.Events; using slskd.Relay; @@ -111,9 +112,9 @@ namespace slskd.Transfers.Uploads UserUploadStatistics GetUserStatistics(string username, DateTime? utcNow = null); /// - /// Returns a list of all uploads matching the optional . + /// Returns a list of all uploads matching the specified . /// - /// An optional expression used to match uploads. + /// An expression used to match uploads. /// A value indicating whether to include uploads that have been removed previously. /// The list of uploads matching the specified expression, or all uploads if no expression is specified. List List(Expression> expression, bool includeRemoved); @@ -822,14 +823,26 @@ namespace slskd.Transfers.Uploads } /// - /// Returns a list of all uploads matching the optional . + /// Returns a list of all uploads matching the specified . /// - /// An optional expression used to match uploads. + /// An expression used to match uploads. /// A value indicating whether to include uploads that have been removed previously. /// The list of uploads matching the specified expression, or all uploads if no expression is specified. public List List(Expression> expression, bool includeRemoved) { expression ??= t => true; + + try + { + return Query(q => q.Where(expression), includeRemoved); + } + catch (Exception ex) + { + Log.Error(ex, "Failed to list uploads: {Message}", ex.Message); + throw; + } + } + /// /// Returns a list of all uploads matching the specified , projected to type . /// -- cgit v1.2.3