mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-09-26 03:09:06 +00:00
Add HeartedCategory
This commit is contained in:
parent
c8dc84e029
commit
3aa4aac772
2 changed files with 22 additions and 14 deletions
|
@ -12,20 +12,7 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
|||
Categories.Add(new TeamPicksCategory());
|
||||
Categories.Add(new NewestLevelsCategory());
|
||||
Categories.Add(new QueueCategory());
|
||||
Categories.Add
|
||||
(
|
||||
new CustomCategory
|
||||
(
|
||||
"Custom Category",
|
||||
"This is a custom category!",
|
||||
"custom1",
|
||||
"g820614",
|
||||
new[]
|
||||
{
|
||||
35, 37, 2979, 3042,
|
||||
}
|
||||
)
|
||||
);
|
||||
Categories.Add(new HeartedCategory());
|
||||
}
|
||||
}
|
||||
}
|
21
ProjectLighthouse/Types/Categories/HeartedCategory.cs
Normal file
21
ProjectLighthouse/Types/Categories/HeartedCategory.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using LBPUnion.ProjectLighthouse.Types.Levels;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace LBPUnion.ProjectLighthouse.Types.Categories
|
||||
{
|
||||
public class HeartedCategory : CategoryWithUser
|
||||
{
|
||||
public override string Name { get; set; } = "My Hearted Levels";
|
||||
public override string Description { get; set; } = "Levels you've hearted in the past";
|
||||
public override string IconHash { get; set; } = "g820607";
|
||||
public override string Endpoint { get; set; } = "hearted";
|
||||
public override Slot? GetPreviewSlot(Database database, User user) => database.HeartedLevels.FirstOrDefault(h => h.UserId == user.UserId)?.Slot;
|
||||
public override int GetTotalSlots(Database database, User user) => database.HeartedLevels.Count(h => h.UserId == user.UserId);
|
||||
public override IEnumerable<Slot> GetSlots(Database database, User user, int pageStart, int pageSize)
|
||||
=> database.HeartedLevels.Where(h => h.UserId == user.UserId).Include(h => h.Slot).Select(h => h.Slot).Skip(pageStart).Take(Math.Min(pageSize, 20));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue