Rewrite gameserver slot filter system (#763)

* Initial implementation of new slot sorting and filtering system

* Initial implementation of filtering for lbp3 community tab

* Add support for organization on lbp3

* Add playlist and user categories

* Implement unit tests for all filters
Refactor more systems to use PaginationData

* Fix PlayerCountFilter test

* Add more unit tests and integration tests for the filter system

* Fix LBP2 move filter and gameFilterType

* Fix sort by likes in LBP3 category

* Add sort for total plays

* Remove extra whitespace and make styling more consistent

* Order hearted and queued levels by primary key ID

* Fix query without order warnings
This commit is contained in:
Josh 2023-05-31 16:33:39 -05:00 committed by GitHub
commit 0c1e350fa3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
106 changed files with 4040 additions and 1183 deletions

View file

@ -8,7 +8,6 @@ namespace LBPUnion.ProjectLighthouse.Tests.Helpers;
public static class IntegrationHelper
{
private static readonly Lazy<bool> dbConnected = new(IsDbConnected);
private static bool IsDbConnected() => ServerStatics.DbConnected;

View file

@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.EntityFrameworkCore;
using Xunit;
namespace LBPUnion.ProjectLighthouse.Tests.Helpers;
@ -38,6 +39,18 @@ public static class MockHelper
UserToken = "unittest",
};
public static T2 CastTo<T1, T2>(this IActionResult result) where T1 : ObjectResult
{
Assert.IsType<T1>(result);
T1? typedResult = result as T1;
Assert.NotNull(typedResult);
Assert.NotNull(typedResult.Value);
Assert.IsType<T2?>(typedResult.Value);
T2? finalResult = (T2?)typedResult.Value;
Assert.NotNull(finalResult);
return finalResult;
}
public static async Task<DatabaseContext> GetTestDatabase(IEnumerable<IList> sets, [CallerMemberName] string caller = "", [CallerLineNumber] int lineNum = 0)
{
Dictionary<Type, IList> setDict = new();
@ -109,9 +122,14 @@ public static class MockHelper
}
public static void SetupTestController(this ControllerBase controllerBase, string? body = null)
{
SetupTestController(controllerBase, GetUnitTestToken(), body);
}
public static void SetupTestController(this ControllerBase controllerBase, GameTokenEntity token, string? body = null)
{
controllerBase.ControllerContext = GetMockControllerContext(body);
SetupTestGameToken(controllerBase, GetUnitTestToken());
SetupTestGameToken(controllerBase, token);
}
public static ControllerContext GetMockControllerContext() =>