Skip to content

Commit

Permalink
Merge pull request #242 from boostcampwm2023/BE-feature/update-db-tree
Browse files Browse the repository at this point in the history
마인드맵 보드 저장
  • Loading branch information
tnpfldyd authored Dec 11, 2023
2 parents 1a59e8b + 6eec42e commit 14b22db
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions nestjs-BE/server/src/board-trees/board-trees.gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export class BoardTreesGateway {
const operation =
operationTypeMap[serializedOperation.operationType](serializedOperation);
this.boardTreesService.applyOperation(boardId, operation);
this.boardTreesService.updateTreeData(boardId);

client.broadcast
.to(boardId)
Expand Down
7 changes: 7 additions & 0 deletions nestjs-BE/server/src/board-trees/board-trees.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,11 @@ export class BoardTreesService {
hasTree(boardId: string) {
return this.boardTrees.has(boardId);
}

updateTreeData(boardId: string) {
const tree = this.boardTrees.get(boardId);
this.boardTreeModel
.updateOne({ boardId }, { tree: JSON.stringify(tree) })
.exec();
}
}

0 comments on commit 14b22db

Please sign in to comment.