diff options
| author | JP Dillingham <jp@dillingham.me> | 2023-12-27 12:12:02 -0600 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2023-12-27 12:12:02 -0600 |
| commit | bd338423afb1f8d361deccfd4786e7ec4b27e8dc (patch) | |
| tree | ee6e3749b36f5bf3a3af51ff966772ed65ce95cd /src/slskd/Shares/SqliteShareRepository.cs | |
| parent | de6d7017ef5efbfe594be516278139265ca6668e (diff) | |
| download | slskd-bd338423afb1f8d361deccfd4786e7ec4b27e8dc.tar.gz | |
simplify (and implement) list options
Diffstat (limited to 'src/slskd/Shares/SqliteShareRepository.cs')
| -rw-r--r-- | src/slskd/Shares/SqliteShareRepository.cs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/slskd/Shares/SqliteShareRepository.cs b/src/slskd/Shares/SqliteShareRepository.cs index 3591522d..57a76177 100644 --- a/src/slskd/Shares/SqliteShareRepository.cs +++ b/src/slskd/Shares/SqliteShareRepository.cs @@ -20,7 +20,6 @@ namespace slskd.Shares using System; using System.Collections.Generic; using System.Linq; - using System.Linq.Expressions; using System.Timers; using Microsoft.Data.Sqlite; using Serilog; @@ -421,14 +420,15 @@ namespace slskd.Shares } /// <summary> - /// Returns the list of all <see cref="Scan"/> s matching the optionally specified <paramref name="predicate"/>. + /// Returns the list of all <see cref="Scan"/> started at or after the specified <paramref name="startedAtOrAfter"/> + /// unix timestamp. /// </summary> - /// <param name="predicate">An optional expression used to filter scans.</param> + /// <param name="startedAtOrAfter">A unix timestamp that serves as the lower bound of the time-based listing.</param> /// <returns>The operation context, including the list of found scans.</returns> - public IEnumerable<Scan> ListScans(Expression<Func<Scan, bool>> predicate = null) + public IEnumerable<Scan> ListScans(long startedAtOrAfter = 0) { using var conn = GetConnection(); - using var cmd = new SqliteCommand("SELECT timestamp, options, COALESCE(end, -1), suspect FROM scans", conn); + using var cmd = new SqliteCommand($"SELECT timestamp, options, COALESCE(end, -1), suspect FROM scans WHERE timestamp >= {startedAtOrAfter}", conn); var reader = cmd.ExecuteReader(); var scans = new List<Scan>(); |
