mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-09 14:51:27 +00:00
Add ordering to LBP2 search
This commit is contained in:
parent
5af66ec850
commit
d4b9ca666b
1 changed files with 5 additions and 1 deletions
|
@ -3,6 +3,7 @@ using LBPUnion.ProjectLighthouse.Database;
|
||||||
using LBPUnion.ProjectLighthouse.Extensions;
|
using LBPUnion.ProjectLighthouse.Extensions;
|
||||||
using LBPUnion.ProjectLighthouse.Filter;
|
using LBPUnion.ProjectLighthouse.Filter;
|
||||||
using LBPUnion.ProjectLighthouse.Filter.Filters;
|
using LBPUnion.ProjectLighthouse.Filter.Filters;
|
||||||
|
using LBPUnion.ProjectLighthouse.Filter.Sorts;
|
||||||
using LBPUnion.ProjectLighthouse.Servers.GameServer.Extensions;
|
using LBPUnion.ProjectLighthouse.Servers.GameServer.Extensions;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Entities.Level;
|
using LBPUnion.ProjectLighthouse.Types.Entities.Level;
|
||||||
using LBPUnion.ProjectLighthouse.Types.Entities.Token;
|
using LBPUnion.ProjectLighthouse.Types.Entities.Token;
|
||||||
|
@ -41,8 +42,11 @@ public class SearchController : ControllerBase
|
||||||
|
|
||||||
pageData.TotalElements = await this.database.Slots.Where(queryBuilder.Build()).CountAsync();
|
pageData.TotalElements = await this.database.Slots.Where(queryBuilder.Build()).CountAsync();
|
||||||
|
|
||||||
|
SlotSortBuilder<SlotEntity> sortBuilder = new();
|
||||||
|
sortBuilder.AddSort(new LastUpdatedSort());
|
||||||
|
|
||||||
List<SlotBase> slots = await this.database.Slots.Include(s => s.Creator)
|
List<SlotBase> slots = await this.database.Slots.Include(s => s.Creator)
|
||||||
.GetSlots(token, queryBuilder, pageData, new SlotSortBuilder<SlotEntity>());
|
.GetSlots(token, queryBuilder, pageData, sortBuilder);
|
||||||
|
|
||||||
return this.Ok(new GenericSlotResponse(keyName, slots, pageData));
|
return this.Ok(new GenericSlotResponse(keyName, slots, pageData));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue