From edf129b33cd5efaba6f7710f77568f0876b5a846 Mon Sep 17 00:00:00 2001 From: Fshmit <122355627+Fshmit@users.noreply.github.com> Date: Mon, 19 Aug 2024 16:54:43 +0200 Subject: [PATCH] EW-1000 renamed the get course by id API to cc-metadata (#5188) --- .../learnroom/controller/api-test/course.api.spec.ts | 4 ++-- .../src/modules/learnroom/controller/course.controller.ts | 6 ++++-- 2 files changed, 6 insertions(+), 4 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..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 @@ -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({ @@ -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); diff --git a/apps/server/src/modules/learnroom/controller/course.controller.ts b/apps/server/src/modules/learnroom/controller/course.controller.ts index c8114d067df..b4bb581fdb3 100644 --- a/apps/server/src/modules/learnroom/controller/course.controller.ts +++ b/apps/server/src/modules/learnroom/controller/course.controller.ts @@ -131,11 +131,13 @@ 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.' }) - 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);