Skip to content

Commit

Permalink
apply requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
uidp committed Jan 15, 2025
1 parent 577941f commit 3d5ae27
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ export class BoardNodeAuthorizableService implements AuthorizationLoaderService
/**
* @deprecated
*/
async findById(id: EntityId): Promise<BoardNodeAuthorizable> {
public async findById(id: EntityId): Promise<BoardNodeAuthorizable> {
const boardNode = await this.boardNodeRepo.findById(id, 1);

const boardNodeAuthorizable = this.getBoardAuthorizable(boardNode);

return boardNodeAuthorizable;
}

async getBoardAuthorizable(boardNode: AnyBoardNode): Promise<BoardNodeAuthorizable> {
public async getBoardAuthorizable(boardNode: AnyBoardNode): Promise<BoardNodeAuthorizable> {
const rootNode = await this.boardNodeService.findRoot(boardNode, 1);
const parentNode = await this.boardNodeService.findParent(boardNode, 1);
const users = await this.boardContextService.getUsersWithBoardRoles(rootNode);
Expand All @@ -48,15 +48,14 @@ export class BoardNodeAuthorizableService implements AuthorizationLoaderService
return boardNodeAuthorizable;
}

async getBoardAuthorizables(boardNodes: AnyBoardNode[]): Promise<BoardNodeAuthorizable[]> {
public async getBoardAuthorizables(boardNodes: AnyBoardNode[]): Promise<BoardNodeAuthorizable[]> {
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);
Expand Down

0 comments on commit 3d5ae27

Please sign in to comment.