mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-02 01:58:40 +00:00
Show sublevels for creators of sublevels
This commit is contained in:
parent
a3e8c29142
commit
3cda95447b
1 changed files with 10 additions and 5 deletions
|
@ -24,16 +24,22 @@ public class SlotsController : ControllerBase
|
||||||
this.database = database;
|
this.database = database;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IQueryable<Slot> getSlots(GameVersion gameVersion)
|
private IQueryable<Slot> getSlots(GameVersion gameVersion, bool includeSublevels = false)
|
||||||
{
|
{
|
||||||
IQueryable<Slot> query = this.database.Slots.Include(s => s.Creator).Include(s => s.Location);
|
IQueryable<Slot> query = this.database.Slots.Include(s => s.Creator).Include(s => s.Location);
|
||||||
|
|
||||||
if (gameVersion == GameVersion.LittleBigPlanetVita || gameVersion == GameVersion.LittleBigPlanetPSP || gameVersion == GameVersion.Unknown)
|
if (gameVersion == GameVersion.LittleBigPlanetVita || gameVersion == GameVersion.LittleBigPlanetPSP || gameVersion == GameVersion.Unknown)
|
||||||
{
|
{
|
||||||
return query.Where(s => s.GameVersion == gameVersion && !s.SubLevel);
|
query = query.Where(s => s.GameVersion == gameVersion);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
query = query.Where(s => s.GameVersion <= gameVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
return query.Where(s => s.GameVersion <= gameVersion && !s.SubLevel);
|
if (!includeSublevels) query = query.Where(s => !s.SubLevel);
|
||||||
|
|
||||||
|
return query;
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("slots/by")]
|
[HttpGet("slots/by")]
|
||||||
|
@ -49,8 +55,7 @@ public class SlotsController : ControllerBase
|
||||||
|
|
||||||
string response = Enumerable.Aggregate
|
string response = Enumerable.Aggregate
|
||||||
(
|
(
|
||||||
this.getSlots
|
this.getSlots(gameVersion, token.UserId == user.UserId)
|
||||||
(gameVersion)
|
|
||||||
.Where(s => s.Creator!.Username == user.Username)
|
.Where(s => s.Creator!.Username == user.Username)
|
||||||
.Skip(pageStart - 1)
|
.Skip(pageStart - 1)
|
||||||
.Take(Math.Min(pageSize, ServerSettings.Instance.EntitledSlots)),
|
.Take(Math.Min(pageSize, ServerSettings.Instance.EntitledSlots)),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue