diff --git a/src/Modix.Data/Models/RecordsPage.cs b/src/Modix.Data/Models/RecordsPage.cs
deleted file mode 100644
index b07a626b5..000000000
--- a/src/Modix.Data/Models/RecordsPage.cs
+++ /dev/null
@@ -1,26 +0,0 @@
-using System.Collections.Generic;
-
-namespace Modix.Data.Models
-{
- ///
- /// Describes paged subset of records, from a larger recordset.
- ///
- /// The type of record contained in the page.
- public class RecordsPage
- {
- ///
- /// The total number of records in the recordset.
- ///
- public long TotalRecordCount { get; set; }
-
- ///
- /// The number of records in the recordset, after applying an optional set of filtering criteria.
- ///
- public long FilteredRecordCount { get; set; }
-
- ///
- /// The current page of records, selected from the larger recordset.
- ///
- public IReadOnlyCollection Records { get; set; } = null!;
- }
-}
diff --git a/src/Modix.Data/Repositories/DeletedMessageRepository.cs b/src/Modix.Data/Repositories/DeletedMessageRepository.cs
index 770de2bc0..8d52a75ae 100644
--- a/src/Modix.Data/Repositories/DeletedMessageRepository.cs
+++ b/src/Modix.Data/Repositories/DeletedMessageRepository.cs
@@ -10,6 +10,7 @@
using Modix.Data.Models;
using Modix.Data.Models.Moderation;
using Modix.Data.Utilities;
+using Modix.Models;
namespace Modix.Data.Repositories
{
diff --git a/src/Modix.Data/Repositories/InfractionRepository.cs b/src/Modix.Data/Repositories/InfractionRepository.cs
index 59b1d5df4..c1c3d8a8e 100644
--- a/src/Modix.Data/Repositories/InfractionRepository.cs
+++ b/src/Modix.Data/Repositories/InfractionRepository.cs
@@ -9,6 +9,7 @@
using Modix.Data.Models;
using Modix.Data.Models.Moderation;
using Modix.Data.Utilities;
+using Modix.Models;
using Modix.Models.Moderation;
namespace Modix.Data.Repositories
diff --git a/src/Modix.Models/RecordsPage.cs b/src/Modix.Models/RecordsPage.cs
new file mode 100644
index 000000000..0c514532f
--- /dev/null
+++ b/src/Modix.Models/RecordsPage.cs
@@ -0,0 +1,23 @@
+namespace Modix.Models;
+
+///
+/// Describes paged subset of records, from a larger recordset.
+///
+/// The type of record contained in the page.
+public class RecordsPage
+{
+ ///
+ /// The total number of records in the recordset.
+ ///
+ public long TotalRecordCount { get; set; }
+
+ ///
+ /// The number of records in the recordset, after applying an optional set of filtering criteria.
+ ///
+ public long FilteredRecordCount { get; set; }
+
+ ///
+ /// The current page of records, selected from the larger recordset.
+ ///
+ public IReadOnlyCollection Records { get; set; } = null!;
+}
diff --git a/src/Modix.Services/Moderation/ModerationService.cs b/src/Modix.Services/Moderation/ModerationService.cs
index 7ae50f6a1..4aee44fc5 100644
--- a/src/Modix.Services/Moderation/ModerationService.cs
+++ b/src/Modix.Services/Moderation/ModerationService.cs
@@ -1,21 +1,21 @@
#nullable enable
using System;
-using System.Linq;
using System.Collections.Generic;
+using System.Linq;
+using System.Threading;
using System.Threading.Tasks;
using Discord;
using Discord.Net;
-using Discord.WebSocket;
using Modix.Data.Models;
using Modix.Data.Models.Core;
using Modix.Data.Models.Moderation;
using Modix.Data.Repositories;
+using Modix.Models;
+using Modix.Models.Core;
+using Modix.Models.Moderation;
using Modix.Services.Core;
using Modix.Services.Utilities;
using Serilog;
-using System.Threading;
-using Modix.Models.Core;
-using Modix.Models.Moderation;
namespace Modix.Services.Moderation
{
diff --git a/src/Modix.Web.Wasm/Components/Infractions/DeletedMessages.razor b/src/Modix.Web.Wasm/Components/Infractions/DeletedMessages.razor
index d4be8be54..5fe136d75 100644
--- a/src/Modix.Web.Wasm/Components/Infractions/DeletedMessages.razor
+++ b/src/Modix.Web.Wasm/Components/Infractions/DeletedMessages.razor
@@ -1,4 +1,5 @@
-@using Modix.Web.Shared.Models.DeletedMessages
+@using Modix.Models
+@using Modix.Web.Shared.Models.DeletedMessages
@using MudBlazor
Modix - Deletions
@@ -66,7 +67,7 @@
-
+
Refresh
@@ -176,12 +177,12 @@
response.EnsureSuccessStatusCode();
- var result = await response.Content.ReadFromJsonAsync();
+ var result = await response.Content.ReadFromJsonAsync>();
return new TableData
{
- TotalItems = result.Length,
- Items = result
+ TotalItems = (int)result.TotalRecordCount,
+ Items = result.Records
};
}
diff --git a/src/Modix.Web.Wasm/Components/Infractions/Infractions.razor b/src/Modix.Web.Wasm/Components/Infractions/Infractions.razor
index c333ae0a7..af70a14c7 100644
--- a/src/Modix.Web.Wasm/Components/Infractions/Infractions.razor
+++ b/src/Modix.Web.Wasm/Components/Infractions/Infractions.razor
@@ -1,4 +1,5 @@
@using Microsoft.AspNetCore.Components.Authorization
+@using Modix.Models
@using Modix.Models.Core
@using Modix.Web.Models;
@using Modix.Web.Shared.Models.Common
@@ -79,7 +80,6 @@
-
-
+
Id
@@ -416,13 +416,13 @@
using var client = HttpClientFactory.CreateClient("api");
using var response = await client.PutAsJsonAsync("api/infractions", new InfractionsQuery(_tableFilter, tableState));
response.EnsureSuccessStatusCode();
-
- var infractions = await response.Content.ReadFromJsonAsync();
+
+ var infractions = await response.Content.ReadFromJsonAsync>();
return new TableData
{
- Items = infractions,
- TotalItems = infractions.Length
+ Items = infractions.Records,
+ TotalItems = (int)infractions.TotalRecordCount
};
}
diff --git a/src/Modix.Web/Controllers/DeletedMessagesController.cs b/src/Modix.Web/Controllers/DeletedMessagesController.cs
index 7d9377478..2993e2ebb 100644
--- a/src/Modix.Web/Controllers/DeletedMessagesController.cs
+++ b/src/Modix.Web/Controllers/DeletedMessagesController.cs
@@ -5,11 +5,11 @@
using Microsoft.AspNetCore.Mvc;
using Modix.Data.Models;
using Modix.Data.Models.Moderation;
+using Modix.Models;
using Modix.Models.Core;
using Modix.Services.Moderation;
using Modix.Services.Utilities;
using Modix.Web.Shared.Models.DeletedMessages;
-using MudBlazor;
namespace Modix.Web.Controllers;
@@ -27,7 +27,7 @@ public DeletedMessagesController(IModerationService moderationService, DiscordSo
}
[HttpPut]
- public async Task GetDeletedMessagesBatchAsync(DeletedMessagesQuery deletedMessagesQuery)
+ public async Task> GetDeletedMessagesBatchAsync(DeletedMessagesQuery deletedMessagesQuery)
{
var tableState = deletedMessagesQuery.TableState;
var tableFilter = deletedMessagesQuery.Filter;
@@ -60,10 +60,9 @@ public async Task GetDeletedMessagesBatchAsync
PageSize = tableState.PageSize,
};
-
var deletedMessages = await _moderationService.SearchDeletedMessagesAsync(searchCriteria, [sortingCriteria], pagingCriteria);
- return deletedMessages.Records
+ var deletedMessagesBatchInformation = deletedMessages.Records
.Select(x => new DeletedMessageBatchInformation(
x.Channel.Name,
x.Author.GetFullUsername(),
@@ -73,6 +72,13 @@ public async Task GetDeletedMessagesBatchAsync
x.Reason,
x.BatchId))
.ToArray();
+
+ return new RecordsPage
+ {
+ FilteredRecordCount = deletedMessagesBatchInformation.Length,
+ Records = deletedMessagesBatchInformation,
+ TotalRecordCount = deletedMessages.TotalRecordCount
+ };
}
[HttpGet("{batchId}")]
diff --git a/src/Modix.Web/Controllers/InfractionsController.cs b/src/Modix.Web/Controllers/InfractionsController.cs
index e1533b93a..5b91caa2b 100644
--- a/src/Modix.Web/Controllers/InfractionsController.cs
+++ b/src/Modix.Web/Controllers/InfractionsController.cs
@@ -3,10 +3,10 @@
using Microsoft.AspNetCore.Mvc;
using Modix.Data.Models;
using Modix.Data.Models.Moderation;
+using Modix.Models;
using Modix.Models.Core;
using Modix.Services.Moderation;
using Modix.Web.Shared.Models.Infractions;
-using MudBlazor;
namespace Modix.Web.Controllers;
@@ -25,7 +25,7 @@ public InfractionsController(IModerationService moderationService, DiscordSocket
[HttpPut]
[Authorize(Roles = nameof(AuthorizationClaim.ModerationRead))]
- public async Task GetInfractionsAsync(InfractionsQuery infractionsQuery)
+ public async Task> GetInfractionsAsync(InfractionsQuery infractionsQuery)
{
var tableState = infractionsQuery.TableState;
var tableFilter = infractionsQuery.Filter;
@@ -67,7 +67,7 @@ public async Task GetInfractionsAsync(InfractionsQuery infract
outranksValues[subjectId] = await _moderationService.DoesModeratorOutrankUserAsync(guildId, SocketUser.Id, subjectId);
}
- return infractions.Records
+ var infractionData = infractions.Records
.Select(x => new InfractionData(
x.Id,
x.GuildId,
@@ -90,6 +90,13 @@ x.DeleteAction is null
&& outranksValues[x.Subject.Id]
))
.ToArray();
+
+ return new RecordsPage
+ {
+ FilteredRecordCount = infractions.Records.Count,
+ Records = infractionData,
+ TotalRecordCount = infractions.TotalRecordCount,
+ };
}
[Authorize(Roles = nameof(AuthorizationClaim.ModerationRescind))]