From 689656844be6dd108bb45f622519093c3689cf5b Mon Sep 17 00:00:00 2001 From: Uwe Ilgenstein Date: Wed, 27 Nov 2024 19:54:30 +0100 Subject: [PATCH] implement draft status on board copy --- .../api-test/board-copy-in-course.api.spec.ts | 21 +++++++++++++++++++ .../internal/column-board-copy.service.ts | 1 + 2 files changed, 22 insertions(+) diff --git a/apps/server/src/modules/board/controller/api-test/board-copy-in-course.api.spec.ts b/apps/server/src/modules/board/controller/api-test/board-copy-in-course.api.spec.ts index c196444e28..5d1b966ee0 100644 --- a/apps/server/src/modules/board/controller/api-test/board-copy-in-course.api.spec.ts +++ b/apps/server/src/modules/board/controller/api-test/board-copy-in-course.api.spec.ts @@ -82,6 +82,27 @@ describe(`board copy with course relation (api)`, () => { expect(result).toBeDefined(); }); + it('should set draft status on the board copy', async () => { + const { loggedInClient, columnBoardNode } = await setup(); + + const response = await loggedInClient.post(`${columnBoardNode.id}/copy`); + const body = response.body as CopyApiResponse; + + const expectedBody: CopyApiResponse = { + id: expect.any(String), + type: CopyElementType.COLUMNBOARD, + status: CopyStatusEnum.SUCCESS, + destinationId: columnBoardNode.context?.id, + }; + + expect(body).toEqual(expectedBody); + + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + const result = await em.findOneOrFail(BoardNodeEntity, body.id!); + + expect(result.isVisible).toBe(false); + }); + describe('with invalid id', () => { it('should return status 400', async () => { const { loggedInClient } = await setup(); diff --git a/apps/server/src/modules/board/service/internal/column-board-copy.service.ts b/apps/server/src/modules/board/service/internal/column-board-copy.service.ts index 785694734f..531ec8c351 100644 --- a/apps/server/src/modules/board/service/internal/column-board-copy.service.ts +++ b/apps/server/src/modules/board/service/internal/column-board-copy.service.ts @@ -54,6 +54,7 @@ export class ColumnBoardCopyService { ); } copyStatus.copyEntity.context = params.targetExternalReference; + copyStatus.copyEntity.isVisible = false; await this.boardNodeService.addRoot(copyStatus.copyEntity); copyStatus.originalEntity = originalBoard;