summaryrefslogtreecommitdiff
path: root/Server/Controllers/ApiFeedController.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Server/Controllers/ApiFeedController.cs')
-rw-r--r--Server/Controllers/ApiFeedController.cs23
1 files changed, 23 insertions, 0 deletions
diff --git a/Server/Controllers/ApiFeedController.cs b/Server/Controllers/ApiFeedController.cs
new file mode 100644
index 0000000..fb260e6
--- /dev/null
+++ b/Server/Controllers/ApiFeedController.cs
@@ -0,0 +1,23 @@
+using HyperBooru.ApiModels;
+using HyperBooru.Services;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+
+namespace HyperBooru.Controllers;
+
+[ApiController]
+[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());
+ }
+}