mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-28 16:08:38 +00:00
Refactor LBP3 text search to use the category system
This commit is contained in:
parent
2ec6bff8e2
commit
cd926a8415
11 changed files with 51 additions and 30 deletions
|
@ -20,6 +20,7 @@ public static class CategoryHelper
|
|||
Categories.Add(new QueueCategory());
|
||||
Categories.Add(new HeartedCategory());
|
||||
Categories.Add(new LuckyDipCategory());
|
||||
Categories.Add(new TextSearchCategory());
|
||||
|
||||
using DatabaseContext database = DatabaseContext.CreateNewInstance();
|
||||
foreach (DatabaseCategoryEntity category in database.CustomCategories) Categories.Add(new CustomCategory(category));
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
using LBPUnion.ProjectLighthouse.Database;
|
||||
using LBPUnion.ProjectLighthouse.Extensions;
|
||||
using LBPUnion.ProjectLighthouse.Filter;
|
||||
using LBPUnion.ProjectLighthouse.Filter.Sorts;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Level;
|
||||
using LBPUnion.ProjectLighthouse.Types.Entities.Token;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Categories;
|
||||
|
||||
public class TextSearchCategory : SlotCategory
|
||||
{
|
||||
public override string Name { get; set; } = "";
|
||||
public override string Description { get; set; } = "";
|
||||
public override string IconHash { get; set; } = "";
|
||||
public override string Endpoint { get; set; } = "text";
|
||||
public override string Tag => "text";
|
||||
|
||||
public override IQueryable<SlotEntity> GetItems
|
||||
(DatabaseContext database, GameTokenEntity token, SlotQueryBuilder queryBuilder) =>
|
||||
database.Slots.Where(queryBuilder.Build())
|
||||
.ApplyOrdering(new SlotSortBuilder<SlotEntity>().AddSort(new TotalPlaysSort()));
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue