From 34c54dc6542c1ba95165db8f22d37052ba51b9e1 Mon Sep 17 00:00:00 2001 From: Firas Shmit Date: Mon, 19 Aug 2024 09:17:13 +0200 Subject: [PATCH 1/3] EW-1000 renamed the get course by id API --- .../modules/learnroom/controller/api-test/course.api.spec.ts | 2 +- .../src/modules/learnroom/controller/course.controller.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/server/src/modules/learnroom/controller/api-test/course.api.spec.ts b/apps/server/src/modules/learnroom/controller/api-test/course.api.spec.ts index d257c42ee98..7d8744d46b2 100644 --- a/apps/server/src/modules/learnroom/controller/api-test/course.api.spec.ts +++ b/apps/server/src/modules/learnroom/controller/api-test/course.api.spec.ts @@ -245,7 +245,7 @@ describe('Course Controller (API)', () => { }); }); - describe('[GET] /courses/:courseId', () => { + describe('[GET] /courses/:courseId/cc-metadata', () => { const setup = async () => { const teacher = createTeacher(); const course = courseFactory.buildWithId({ diff --git a/apps/server/src/modules/learnroom/controller/course.controller.ts b/apps/server/src/modules/learnroom/controller/course.controller.ts index c8114d067df..8fd2e02d8be 100644 --- a/apps/server/src/modules/learnroom/controller/course.controller.ts +++ b/apps/server/src/modules/learnroom/controller/course.controller.ts @@ -131,7 +131,7 @@ export class CourseController { }; } - @Get(':courseId') + @Get(':courseId/cc-metadata') @ApiOperation({ summary: 'Get common cartridge metadata of a course by Id.' }) @ApiBadRequestResponse({ description: 'Request data has invalid format.' }) @ApiInternalServerErrorResponse({ description: 'Internal server error.' }) From 8ccd0cb1da09e12da2592dbe9de19c33258d13bf Mon Sep 17 00:00:00 2001 From: Firas Shmit Date: Mon, 19 Aug 2024 10:24:02 +0200 Subject: [PATCH 2/3] EW-1000 modified a path in the api test --- .../modules/learnroom/controller/api-test/course.api.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/server/src/modules/learnroom/controller/api-test/course.api.spec.ts b/apps/server/src/modules/learnroom/controller/api-test/course.api.spec.ts index 7d8744d46b2..b191b26a0e8 100644 --- a/apps/server/src/modules/learnroom/controller/api-test/course.api.spec.ts +++ b/apps/server/src/modules/learnroom/controller/api-test/course.api.spec.ts @@ -263,7 +263,7 @@ describe('Course Controller (API)', () => { const { course, teacher } = await setup(); const loggedInClient = await testApiClient.login(teacher.account); - const response = await loggedInClient.get(`${course.id}`); + const response = await loggedInClient.get(`${course.id}/cc-metadata`); const data = response.body as CourseCommonCartridgeMetadataResponse; expect(response.statusCode).toBe(200); From 46a02d53bc629f62063cdcfe7b20b72118870841 Mon Sep 17 00:00:00 2001 From: Firas Shmit Date: Mon, 19 Aug 2024 16:38:07 +0200 Subject: [PATCH 3/3] EW-1000 edited name of method --- .../src/modules/learnroom/controller/course.controller.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/server/src/modules/learnroom/controller/course.controller.ts b/apps/server/src/modules/learnroom/controller/course.controller.ts index 8fd2e02d8be..b4bb581fdb3 100644 --- a/apps/server/src/modules/learnroom/controller/course.controller.ts +++ b/apps/server/src/modules/learnroom/controller/course.controller.ts @@ -135,7 +135,9 @@ export class CourseController { @ApiOperation({ summary: 'Get common cartridge metadata of a course by Id.' }) @ApiBadRequestResponse({ description: 'Request data has invalid format.' }) @ApiInternalServerErrorResponse({ description: 'Internal server error.' }) - public async getCourseById(@Param() param: CourseUrlParams): Promise { + public async getCourseCcMetadataById( + @Param() param: CourseUrlParams + ): Promise { const course = await this.courseUc.findCourseById(param.courseId); return CourseMapper.mapToCommonCartridgeMetadataResponse(course);