diff options
| author | Jake Mannens <jake@asger.xyz> | 2026-05-13 00:48:51 +1000 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2026-05-13 00:48:51 +1000 |
| commit | c2b3c05f027d315f4e553ff656d1f06e99a82488 (patch) | |
| tree | aefdc66bb705241807f4365cebe4c4964192d3a4 /Controllers | |
| parent | a565ebb08901e9d1854f8bcfc669063ddea49bce (diff) | |
v0.16av0.16a
Diffstat (limited to 'Controllers')
| -rw-r--r-- | Controllers/ApiFeedController.cs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Controllers/ApiFeedController.cs b/Controllers/ApiFeedController.cs new file mode 100644 index 0000000..382169e --- /dev/null +++ b/Controllers/ApiFeedController.cs @@ -0,0 +1,25 @@ +using HyperBooru.ApiModels; +using HyperBooru.Services; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; + +namespace HyperBooru.Controllers; + +[ApiController] +[Authorize] +[Route("/api/feed")] +public class ApiFeedController : Controller { + private IFeedService feedService; + + public ApiFeedController(IDbContextFactory<HBContext> dbFactory, IFeedService feedService) => + this.feedService = feedService; + + [HttpPost] + public IActionResult FetchChunkAsync([FromBody] FeedRequest feedRequest) { + if(feedRequest.Count > 1000) + return BadRequest("Total number of requested items exceeds maximum"); + + return Ok(feedService.LoadChunk(feedRequest).Select(m => m.Guid).ToArray()); + } +} |
