diff --git a/apps/server/src/modules/board-context/board-context-api-helper.service.ts b/apps/server/src/modules/board-context/board-context-api-helper.service.ts index ae0ce0bd5d..9569ab11e6 100644 --- a/apps/server/src/modules/board-context/board-context-api-helper.service.ts +++ b/apps/server/src/modules/board-context/board-context-api-helper.service.ts @@ -1,7 +1,7 @@ import { BoardExternalReference, BoardExternalReferenceType, BoardNodeService, ColumnBoard } from '@modules/board'; import { CourseService } from '@modules/learnroom'; import { RoomService } from '@modules/room'; -import { Injectable } from '@nestjs/common'; +import { BadRequestException, Injectable } from '@nestjs/common'; import { ConfigService } from '@nestjs/config'; import { CourseFeatures } from '@shared/domain/entity'; import { EntityId, SchoolFeature } from '@shared/domain/types'; @@ -81,7 +81,7 @@ export class BoardContextApiHelperService { } /* istanbul ignore next */ - throw new Error(`Unsupported board reference type ${context.type as string}`); + throw new BadRequestException(`Unsupported board reference type ${context.type as string}`); } private isVideoConferenceEnabledForCourse(courseFeatures?: CourseFeatures[]): boolean { diff --git a/apps/server/src/modules/board/service/board-node-authorizable.service.ts b/apps/server/src/modules/board/service/board-node-authorizable.service.ts index c36b669fdf..c6cc8197b6 100644 --- a/apps/server/src/modules/board/service/board-node-authorizable.service.ts +++ b/apps/server/src/modules/board/service/board-node-authorizable.service.ts @@ -24,7 +24,7 @@ export class BoardNodeAuthorizableService implements AuthorizationLoaderService /** * @deprecated */ - async findById(id: EntityId): Promise { + public async findById(id: EntityId): Promise { const boardNode = await this.boardNodeRepo.findById(id, 1); const boardNodeAuthorizable = this.getBoardAuthorizable(boardNode); @@ -32,7 +32,7 @@ export class BoardNodeAuthorizableService implements AuthorizationLoaderService return boardNodeAuthorizable; } - async getBoardAuthorizable(boardNode: AnyBoardNode): Promise { + public async getBoardAuthorizable(boardNode: AnyBoardNode): Promise { const rootNode = await this.boardNodeService.findRoot(boardNode, 1); const parentNode = await this.boardNodeService.findParent(boardNode, 1); const users = await this.boardContextService.getUsersWithBoardRoles(rootNode); @@ -48,15 +48,14 @@ export class BoardNodeAuthorizableService implements AuthorizationLoaderService return boardNodeAuthorizable; } - async getBoardAuthorizables(boardNodes: AnyBoardNode[]): Promise { + public async getBoardAuthorizables(boardNodes: AnyBoardNode[]): Promise { const rootIds = boardNodes.map((node) => node.rootId); const parentIds = boardNodes.map((node) => node.parentId).filter((defined) => defined) as EntityId[]; const boardNodeMap = await this.getBoardNodeMap([...rootIds, ...parentIds]); const promises = boardNodes.map(async (boardNode) => { const rootNode = boardNodeMap[boardNode.rootId]; - return this.boardContextService.getUsersWithBoardRoles(rootNode).then((users) => { - return { id: boardNode.id, users }; - }); + const users = await this.boardContextService.getUsersWithBoardRoles(rootNode); + return { id: boardNode.id, users }; }); const results = await Promise.all(promises);