mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-13 16:51:27 +00:00
Fix level photos by author
This commit is contained in:
parent
d4b9ca666b
commit
8b0aed9a61
1 changed files with 10 additions and 1 deletions
|
@ -160,7 +160,7 @@ public class PhotosController : ControllerBase
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet("photos/{slotType}/{id:int}")]
|
[HttpGet("photos/{slotType}/{id:int}")]
|
||||||
public async Task<IActionResult> SlotPhotos(string slotType, int id)
|
public async Task<IActionResult> SlotPhotos(string slotType, int id, [FromQuery] string? by)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (SlotHelper.IsTypeInvalid(slotType)) return this.BadRequest();
|
if (SlotHelper.IsTypeInvalid(slotType)) return this.BadRequest();
|
||||||
|
@ -169,7 +169,16 @@ public class PhotosController : ControllerBase
|
||||||
|
|
||||||
PaginationData pageData = this.Request.GetPaginationData();
|
PaginationData pageData = this.Request.GetPaginationData();
|
||||||
|
|
||||||
|
int creatorId = 0;
|
||||||
|
if (by != null)
|
||||||
|
{
|
||||||
|
creatorId = await this.database.Users.Where(u => u.Username == by)
|
||||||
|
.Select(u => u.UserId)
|
||||||
|
.FirstOrDefaultAsync();
|
||||||
|
}
|
||||||
|
|
||||||
List<GamePhoto> photos = (await this.database.Photos.Include(p => p.PhotoSubjects)
|
List<GamePhoto> photos = (await this.database.Photos.Include(p => p.PhotoSubjects)
|
||||||
|
.Where(p => creatorId == 0 || p.CreatorId == creatorId)
|
||||||
.Where(p => p.SlotId == id)
|
.Where(p => p.SlotId == id)
|
||||||
.OrderByDescending(s => s.Timestamp)
|
.OrderByDescending(s => s.Timestamp)
|
||||||
.ApplyPagination(pageData)
|
.ApplyPagination(pageData)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue