File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using ApplicationData . Services ;
2+ using Microsoft . AspNetCore . Mvc ;
3+
4+ namespace WebApi . Controllers . Admin ;
5+
6+ /// <summary>
7+ /// Admin Queue controller
8+ /// </summary>
9+ [ Route ( "v1/admin/queue" ) ]
10+ public class AdminQueueController : AdminApiController
11+ {
12+ private readonly LinkProvider _linkProvider ;
13+
14+ /// <inheritdoc />
15+ public AdminQueueController (
16+ IServiceProvider serviceProvider ,
17+ LinkProvider linkProvider
18+ ) : base ( serviceProvider )
19+ {
20+ _linkProvider = linkProvider ;
21+ }
22+
23+ /// <summary>
24+ /// Retrieve the processing queue
25+ /// </summary>
26+ [ HttpGet ]
27+ [ Route ( "" ) ]
28+ public async Task < IActionResult > GetProcessingQueue ( CancellationToken cancellationToken )
29+ {
30+ var postIdsWithPendingChanges = await _linkProvider . GetRedditPostIdsWithPendingChanges ( cancellationToken )
31+ . Select ( x => new
32+ {
33+ queuedItemId = x . QueuedItemId ,
34+ redditPostId = x . RedditPostId ,
35+ queuedAt = x . QueuedAt ,
36+ } )
37+ . ToArrayAsync ( cancellationToken ) ;
38+
39+ return new OkObjectResult ( new
40+ {
41+ itemCount = postIdsWithPendingChanges . Length ,
42+ queuedItems = postIdsWithPendingChanges ,
43+ } ) ;
44+ }
45+ }
You can’t perform that action at this time.
0 commit comments