Skip to content

Commit

Permalink
fix node loading depth
Browse files Browse the repository at this point in the history
  • Loading branch information
uidp committed May 17, 2024
1 parent 58be6e8 commit b738f74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export class BoardNodeAuthorizableService implements AuthorizationLoaderService
}

async getBoardAuthorizable(boardNode: AnyBoardNode): Promise<BoardNodeAuthorizable> {
const rootNode = await this.boardNodeService.findRoot(boardNode, 1);
const parentNode = await this.boardNodeService.findParent(boardNode, 1);
const rootNode = await this.boardNodeService.findRoot(boardNode);
const parentNode = await this.boardNodeService.findParent(boardNode);
const users = await this.boardContextService.getUsersWithBoardRoles(rootNode);

const boardNodeAuthorizable = new BoardNodeAuthorizable({
Expand Down
6 changes: 3 additions & 3 deletions apps/server/src/modules/board/service/board-node.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class BoardNodeService {
await this.boardNodeRepo.persistAndFlush(boardNode);
}

async addToParent(parent: AnyBoardNode, child: AnyBoardNode, position = 0): Promise<void> {
async addToParent(parent: AnyBoardNode, child: AnyBoardNode, position?: number): Promise<void> {
parent.addChild(child, position);
await this.boardNodeRepo.persistAndFlush(parent);
}
Expand All @@ -47,8 +47,8 @@ export class BoardNodeService {

async move(childId: EntityId, targetParentId: EntityId, targetPosition?: number): Promise<void> {
const child = await this.findById(childId);
const parent = await this.findParent(child, 1);
const targetParent = await this.findById(targetParentId, 1);
const parent = await this.findParent(child);
const targetParent = await this.findById(targetParentId);

// TODO should we make sure child and targetParent belonging to the same board?

Expand Down

0 comments on commit b738f74

Please sign in to comment.