@@ -9,28 +9,53 @@ async function checkJobName(ctx, next) {
99 return next ( ) ;
1010}
1111
12- async function start ( ctx ) {
12+ async function addJobNameToQuery ( ctx , next ) {
1313 const { jobName } = ctx . params ;
1414
15- ctx . bree . start ( jobName ) ;
15+ ctx . query = { name : jobName } ;
16+
17+ return next ( ) ;
18+ }
19+
20+ async function start ( ctx , next ) {
21+ const { jobName } = ctx . params ;
22+
23+ await ctx . bree . start ( jobName ) ;
1624
1725 ctx . body = { } ;
26+
27+ return next ( ) ;
1828}
1929
20- async function stop ( ctx ) {
30+ async function stop ( ctx , next ) {
2131 const { jobName } = ctx . params ;
2232
2333 await ctx . bree . stop ( jobName ) ;
2434
2535 ctx . body = { } ;
36+
37+ return next ( ) ;
2638}
2739
28- async function run ( ctx ) {
40+ async function run ( ctx , next ) {
2941 const { jobName } = ctx . params ;
3042
31- ctx . bree . run ( jobName ) ;
43+ await ctx . bree . run ( jobName ) ;
3244
3345 ctx . body = { } ;
46+
47+ return next ( ) ;
48+ }
49+
50+ async function restart ( ctx , next ) {
51+ const { jobName } = ctx . params ;
52+
53+ await ctx . bree . stop ( jobName ) ;
54+ await ctx . bree . start ( jobName ) ;
55+
56+ ctx . body = { } ;
57+
58+ return next ( ) ;
3459}
3560
36- module . exports = { checkJobName, start, stop, run } ;
61+ module . exports = { checkJobName, addJobNameToQuery , start, stop, run, restart } ;
0 commit comments