Photo retrieval semi-working (only on LBP1?)

This commit is contained in:
jvyden 2021-11-05 19:05:45 -04:00
commit 143fc96cf5
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
4 changed files with 32 additions and 1 deletions

View file

@ -1,7 +1,9 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Xml.Serialization;
using LBPUnion.ProjectLighthouse.Serialization;
using LBPUnion.ProjectLighthouse.Types;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
@ -53,5 +55,15 @@ namespace LBPUnion.ProjectLighthouse.Controllers
return this.Ok();
}
[HttpGet("photos/user/{id:int}")]
public async Task<IActionResult> SlotPhotos(int id)
{
List<Photo> photos = await this.database.Photos.Take(50).ToListAsync();
string response = photos.Aggregate(string.Empty, (s, photo) => s + photo.Serialize(id));
return this.Ok(LbpSerializer.StringElement("photos", response));
}
}
}