Skip to content

Commit eb1f41f

Browse files
committed
fix minor bugs
1 parent 3ddaafc commit eb1f41f

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/routes/api/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { NextFunction, Request, Response, Router } from 'express'
22
import run from './run'
33
import submit from './submit'
4+
import project from './project'
45
import { route as langs } from './langs'
56
import { checkValidApiKey } from '../../validators/ApiKeyValidators'
67
import * as debug from 'debug'
@@ -27,6 +28,7 @@ route.use((req: Request, res: Response, next: NextFunction) => {
2728

2829
route.use('/runs', run)
2930
route.use('/submissions', submit)
31+
route.use('/project', project)
3032
route.use('/langs', langs)
3133

3234
export default route

src/routes/api/project/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ import { Router } from 'express'
22
import Controller from './controller'
33
import Validator from './validators'
44
import { successListener } from 'rabbitmq/jobqueue'
5+
import langValidator from '../../../middlewares/langValidator';
56

67
const router: Router = Router()
78
const validator = new Validator()
89

9-
router.post('/', validator.POST, Controller.runPOST)
10+
router.post('/', validator.POST, langValidator(), Controller.runPOST)
1011
successListener.on('project_result', Controller.onSuccess)
1112

1213
export default router

src/routes/api/project/validators.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ export default class ProjectValidator extends BaseValidator {
1111
}
1212

1313
POSTSchema = Joi.object({
14+
lang: Joi
15+
.string()
16+
.required(),
1417
problem: Joi
1518
.string()
1619
.uri()

0 commit comments

Comments
 (0)