1- import {
2- Controller ,
3- Get ,
4- Post ,
5- Res ,
6- Req ,
7- UseFilters ,
8- UseGuards ,
9- Param ,
10- } from '@nestjs/common' ;
1+ import { Controller , Get , Post , Res , Req , UseFilters , UseGuards , Param } from '@nestjs/common' ;
112import { Response , Request } from 'express' ;
123import { ServiceErrorCatcher } from 'src/common/decorators/catch.decorator' ;
134import { CoursesService } from 'src/base/courses/courses.service' ;
@@ -29,16 +20,15 @@ export class CoursesController {
2920 @Get ( '/allCourses' )
3021 async getAllCourses ( @Res ( ) res : Response ) {
3122 const courses = await this . coursesService . getAllCourses ( ) ;
32- return res . status ( 200 ) . json ( { status : 'ok' , courses } )
23+ return res . status ( 200 ) . json ( { status : 'ok' , courses } ) ;
3324 }
3425
3526 @Get ( '/:id' )
36- async getCoursesById ( @Req ( ) req : Request , @Res ( ) res : Response , @Param ( 'id' ) courseId : string ) {
37- const courseById = await this . coursesService . getCoursesById ( courseId )
27+ async getCoursesById ( @Req ( ) req : Request , @Res ( ) res : Response , @Param ( 'id' ) courseId : string ) {
28+ const courseById = await this . coursesService . getCoursesById ( courseId ) ;
3829 return res . status ( 200 ) . json ( { status : 'ok' , courseById } ) ;
3930 }
4031
41-
4232 @Post ( '/create' )
4333 async createCourse ( @Req ( ) req : Request , @Res ( ) res : Response ) {
4434 await this . coursesService . createCourse ( req . body ) . then ( ( course ) => {
@@ -50,8 +40,4 @@ export class CoursesController {
5040 const courses = await this . coursesService . getAllCourses ( ) ;
5141 return res . status ( 200 ) . json ( courses ) ;
5242 }
53-
5443}
55-
56-
57-
0 commit comments