diff options
| author | Jake Mannens <jake@asger.xyz> | 2026-03-17 03:04:36 +1100 |
|---|---|---|
| committer | Jake Mannens <jake@asger.xyz> | 2026-06-07 12:32:37 +1000 |
| commit | c51ff4e755f009ca0bc8e935a92c04e583c4ee8a (patch) | |
| tree | 0a9a311c5404a96495df1047e613dc3aea3d0f15 /Controllers/ApiFeedController.cs | |
Initial commit
Diffstat (limited to 'Controllers/ApiFeedController.cs')
| -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..068cc17 --- /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) + throw new ApiModels.ArgumentException("Total number of requested items exceeds maximum"); + + return Ok(feedService.LoadChunk(feedRequest).Select(m => m.Guid).ToArray()); + } +} |
