Skip to content

Commit 06688b6

Browse files
committed
fix some errors on courses get controller
1 parent 2314dd3 commit 06688b6

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

src/Contexts/Backoffice/Courses/infrastructure/persistence/ElasticBackofficeCourseRepository.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Criteria } from '../../../../Shared/domain/criteria/Criteria';
12
import { ElasticRepository } from '../../../../Shared/infrastructure/persistence/elasticsearch/ElasticRepository';
23
import { BackofficeCourse } from '../../domain/BackofficeCourse';
34
import { BackofficeCourseRepository } from '../../domain/BackofficeCourseRepository';
@@ -16,4 +17,8 @@ export class ElasticBackofficeCourseRepository
1617
async save(course: BackofficeCourse): Promise<void> {
1718
return this.persist(course);
1819
}
20+
21+
matching(criteria: Criteria): Promise<BackofficeCourse[]> {
22+
throw new Error('Method not implemented.');
23+
}
1924
}

src/apps/backoffice/backend/controllers/CoursesGetController.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Request, Response } from 'express';
22
import httpStatus from 'http-status';
3+
import { BackofficeCourseResponse } from '../../../../Contexts/Backoffice/Courses/application/BackofficeCourseResponse';
4+
import { BackofficeCoursesResponse } from '../../../../Contexts/Backoffice/Courses/application/BackofficeCoursesResponse';
35
import { 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';
66
import { QueryBus } from '../../../../Contexts/Shared/domain/QueryBus';
77
import { 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

Comments
 (0)