File tree Expand file tree Collapse file tree 4 files changed +8
-12
lines changed Expand file tree Collapse file tree 4 files changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,8 @@ type RunPoolElement = {
1818
1919const RunPool : { [ x : number ] : RunPoolElement } = { }
2020
21- class RunController {
22- async RunPOST ( req : Request , res : Response ) {
21+ export default {
22+ async runPOST ( req : Request , res : Response ) {
2323 const mode = req . body . mode || 'sync'
2424 const job = await DB . submissions . create ( {
2525 lang : req . body . lang ,
@@ -49,7 +49,7 @@ class RunController {
4949 RunPool [ job . id ] = {
5050 res
5151 }
52- }
52+ } ,
5353
5454 async onSuccess ( result : RunResponse ) {
5555 const job = await DB . submissions . findById ( result . id )
@@ -64,5 +64,3 @@ class RunController {
6464 }
6565 }
6666}
67-
68- export default new RunController ( )
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { successListener } from 'rabbitmq/jobqueue'
55
66const router : Router = Router ( )
77
8- router . post ( '/' , Validator . POST , Controller . RunPOST )
8+ router . post ( '/' , Validator . POST , Controller . runPOST )
99successListener . on ( 'run_result' , Controller . onSuccess )
1010
1111export default router
Original file line number Diff line number Diff line change @@ -22,8 +22,8 @@ type RunPoolElement = {
2222
2323const RunPool : { [ x : number ] : RunPoolElement } = { }
2424
25- class SubmitController {
26- async SubmitPOST ( req : Request , res : Response ) {
25+ export default {
26+ async submitPOST ( req : Request , res : Response ) {
2727 const mode = req . body . mode || 'sync'
2828 const job = await DB . submissions . create ( {
2929 lang : req . body . lang ,
@@ -51,7 +51,7 @@ class SubmitController {
5151 RunPool [ job . id ] = {
5252 res
5353 }
54- }
54+ } ,
5555
5656 async onSuccess ( result : SubmitResponse ) {
5757 const job = await DB . submissions . findById ( result . id )
@@ -68,5 +68,3 @@ class SubmitController {
6868 }
6969 }
7070}
71-
72- export default new SubmitController ( )
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import { successListener } from 'rabbitmq/jobqueue'
55
66const router : Router = Router ( )
77
8- router . post ( '/' , Validator . POST , Controller . SubmitPOST )
8+ router . post ( '/' , Validator . POST , Controller . submitPOST )
99successListener . on ( 'submit_result' , Controller . onSuccess )
1010
1111export default router
You can’t perform that action at this time.
0 commit comments