11import { Request , Response } from 'express' ;
22import httpStatus from 'http-status' ;
3+ import { BackofficeCourseResponse } from '../../../../Contexts/Backoffice/Courses/application/BackofficeCourseResponse' ;
4+ import { BackofficeCoursesResponse } from '../../../../Contexts/Backoffice/Courses/application/BackofficeCoursesResponse' ;
35import { SearchAllCoursesQuery } from '../../../../Contexts/Backoffice/Courses/application/SearchAll/SearchAllCoursesQuery' ;
4- import { SearchAllCoursesResponse } from '../../../../Contexts/Backoffice/Courses/application/SearchAll/SearchAllCoursesResponse' ;
5- import { BackofficeCourse } from '../../../../Contexts/Backoffice/Courses/domain/BackofficeCourse' ;
66import { QueryBus } from '../../../../Contexts/Shared/domain/QueryBus' ;
77import { Controller } from './Controller' ;
88
@@ -11,13 +11,13 @@ export class CoursesGetController implements Controller {
1111
1212 async run ( _req : Request , res : Response ) {
1313 const query = new SearchAllCoursesQuery ( ) ;
14- const queryResponse : SearchAllCoursesResponse = await this . queryBus . ask ( query ) ;
14+ const queryResponse : BackofficeCoursesResponse = await this . queryBus . ask ( query ) ;
1515
1616 res . header ( 'Access-Control-Allow-Origin' , '*' ) ;
1717 res . status ( httpStatus . OK ) . send ( this . toResponse ( queryResponse . courses ) ) ;
1818 }
1919
20- private toResponse ( courses : Array < BackofficeCourse > ) {
20+ private toResponse ( courses : Array < BackofficeCourseResponse > ) {
2121 return courses . map ( course => ( {
2222 id : course . id . toString ( ) ,
2323 duration : course . duration . toString ( ) ,
0 commit comments