From d0a92fa1156466c75f32c9afcb99728193038ac5 Mon Sep 17 00:00:00 2001 From: Kieran Date: Sun, 11 Sep 2022 16:44:35 +0100 Subject: [PATCH] Get latest scan --- VoidCat/Services/VirusScanner/PostgresVirusScanStore.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/VoidCat/Services/VirusScanner/PostgresVirusScanStore.cs b/VoidCat/Services/VirusScanner/PostgresVirusScanStore.cs index 9cb8ff7..eb1dfd3 100644 --- a/VoidCat/Services/VirusScanner/PostgresVirusScanStore.cs +++ b/VoidCat/Services/VirusScanner/PostgresVirusScanStore.cs @@ -18,16 +18,16 @@ public class PostgresVirusScanStore : IVirusScanStore public async ValueTask Get(Guid id) { await using var conn = await _connection.Get(); - return await conn.QuerySingleOrDefaultAsync( - @"select * from ""VirusScanResult"" where ""Id"" = :id", new {id}); + return await conn.QueryFirstOrDefaultAsync( + @"select * from ""VirusScanResult"" where ""Id"" = :id order by ""ScanTime"" desc", new {id}); } /// public async ValueTask GetByFile(Guid id) { await using var conn = await _connection.Get(); - return await conn.QuerySingleOrDefaultAsync( - @"select * from ""VirusScanResult"" where ""File"" = :file", new {file = id}); + return await conn.QueryFirstOrDefaultAsync( + @"select * from ""VirusScanResult"" where ""File"" = :file order by ""ScanTime"" desc", new {file = id}); } ///