diff --git a/apps/server/src/modules/copy-helper/dto/copy.response.ts b/apps/server/src/modules/copy-helper/dto/copy.response.ts index d3fbb33c8da..549dcac7014 100644 --- a/apps/server/src/modules/copy-helper/dto/copy.response.ts +++ b/apps/server/src/modules/copy-helper/dto/copy.response.ts @@ -45,11 +45,4 @@ export class CopyApiResponse { description: 'List of included sub elements with recursive type structure', }) elements?: CopyApiResponse[]; - - @ApiPropertyOptional({ - isArray: true, - enum: CopyElementType, - description: 'Array with listed types of all sub elements', - }) - elementsTypes?: CopyElementType[]; } diff --git a/apps/server/src/modules/copy-helper/mapper/copy.mapper.ts b/apps/server/src/modules/copy-helper/mapper/copy.mapper.ts index 0e65613fa8f..581e33161bd 100644 --- a/apps/server/src/modules/copy-helper/mapper/copy.mapper.ts +++ b/apps/server/src/modules/copy-helper/mapper/copy.mapper.ts @@ -5,7 +5,7 @@ import { TaskCopyParentParams } from '@modules/task/types'; import { LessonEntity, Task } from '@shared/domain/entity'; import { EntityId } from '@shared/domain/types'; import { CopyApiResponse } from '../dto/copy.response'; -import { CopyElementType, CopyStatus, CopyStatusEnum } from '../types/copy.types'; +import { CopyStatus, CopyStatusEnum } from '../types/copy.types'; export class CopyMapper { static mapToResponse(copyStatus: CopyStatus): CopyApiResponse { @@ -46,19 +46,4 @@ export class CopyMapper { return dto; } - - static mapElementsToTypes(element: CopyStatus, types: CopyElementType[] = []): CopyElementType[] { - const indexOfFound = types.indexOf(element.type); - if (indexOfFound === -1) { - types.push(element.type); - } - - if (element.elements) { - element.elements.forEach((child) => { - this.mapElementsToTypes(child, types); - }); - } - - return types; - } } diff --git a/apps/server/src/modules/copy-helper/service/copy-helper.service.spec.ts b/apps/server/src/modules/copy-helper/service/copy-helper.service.spec.ts index fb44adb6e64..27276237119 100644 --- a/apps/server/src/modules/copy-helper/service/copy-helper.service.spec.ts +++ b/apps/server/src/modules/copy-helper/service/copy-helper.service.spec.ts @@ -124,6 +124,7 @@ describe('copy helper service', () => { expect(derivedStatus).toEqual(CopyStatusEnum.FAIL); }); + it('should return fail if the last and only nested child is FAIL ', () => { const element = createNestedStates([ CopyStatusEnum.SUCCESS, diff --git a/apps/server/src/modules/learnroom/controller/rooms.controller.ts b/apps/server/src/modules/learnroom/controller/rooms.controller.ts index 7caa9149d87..7e73104e0d1 100644 --- a/apps/server/src/modules/learnroom/controller/rooms.controller.ts +++ b/apps/server/src/modules/learnroom/controller/rooms.controller.ts @@ -69,7 +69,6 @@ export class RoomsController { ): Promise { const copyStatus = await this.courseCopyUc.copyCourse(currentUser.userId, urlParams.roomId); const dto = CopyMapper.mapToResponse(copyStatus); - dto.elementsTypes = CopyMapper.mapElementsToTypes(copyStatus); return dto; }