Skip to content

Commit b6fdf96

Browse files
committed
Extract params from request
1 parent 359e893 commit b6fdf96

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/apps/mooc_backend/controllers/CreateCourseController.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,15 @@ import CreateCourse from '../../../Mooc/Courses/application/CreateCourse';
33
import httpStatus from 'http-status';
44

55
export default class CreateCourseController {
6-
constructor(private createUser: CreateCourse) {}
6+
constructor(private createCourse: CreateCourse) {}
77

88
async create(req: Request, res: Response) {
9+
const id: string = req.params.id;
10+
const name: string = req.body.name;
11+
const duration: string = req.body.duration;
12+
913
try {
10-
await this.createUser.run();
14+
await this.createCourse.run(id, name, duration);
1115
} catch (e) {
1216
res.status(500).json(e);
1317
}

0 commit comments

Comments
 (0)