File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,18 +7,18 @@ namespace GithubActionsOrchestrator;
77public class ApiController : Controller
88{
99 [ Route ( "get-runners" ) ]
10- public async Task < IResult > GetRunners ( )
10+ public async Task < IResult > GetRunners ( [ FromQuery ] int limit = 100 , [ FromQuery ] int offset = 0 )
1111 {
1212 var db = new ActionsRunnerContext ( ) ;
13- var recentRunners = await db . Runners . Include ( x => x . Lifecycle ) . Include ( x => x . Job ) . OrderByDescending ( x => x . RunnerId ) . Take ( 100 ) . ToListAsync ( ) ;
13+ var recentRunners = await db . Runners . Include ( x => x . Lifecycle ) . Include ( x => x . Job ) . OrderByDescending ( x => x . RunnerId ) . Skip ( offset ) . Take ( limit ) . ToListAsync ( ) ;
1414 return Results . Json ( recentRunners ) ;
1515 }
1616
1717 [ Route ( "get-jobs" ) ]
18- public async Task < IResult > GetJobs ( )
18+ public async Task < IResult > GetJobs ( [ FromQuery ] int limit = 100 , [ FromQuery ] int offset = 0 )
1919 {
2020 var db = new ActionsRunnerContext ( ) ;
21- var recentRunners = await db . Jobs . OrderByDescending ( x => x . JobId ) . Take ( 100 ) . ToListAsync ( ) ;
21+ var recentRunners = await db . Jobs . OrderByDescending ( x => x . JobId ) . Skip ( offset ) . Take ( limit ) . ToListAsync ( ) ;
2222 return Results . Json ( recentRunners ) ;
2323 }
2424
You can’t perform that action at this time.
0 commit comments