Remove redundant store APIs for Boards: (#22968)

- getBlocksWithParent
- getBlocksWithParentAndType
- getBlocksWithType
- getBlocksForBoard
Этот коммит содержится в:
Doug Lauder
2023-04-17 06:33:07 -04:00
коммит произвёл GitHub
родитель 496b1e4e1c
Коммит a80e1e21b9
14 изменённых файлов: 128 добавлений и 190 удалений

Просмотреть файл

@@ -18,20 +18,11 @@ import (
var ErrBlocksFromMultipleBoards = errors.New("the block set contain blocks from multiple boards")
func (a *App) GetBlocks(boardID, parentID string, blockType string) ([]*model.Block, error) {
if boardID == "" {
func (a *App) GetBlocks(opts model.QueryBlocksOptions) ([]*model.Block, error) {
if opts.BoardID == "" {
return []*model.Block{}, nil
}
if blockType != "" && parentID != "" {
return a.store.GetBlocksWithParentAndType(boardID, parentID, blockType)
}
if blockType != "" {
return a.store.GetBlocksWithType(boardID, blockType)
}
return a.store.GetBlocksWithParent(boardID, parentID)
return a.store.GetBlocks(opts)
}
func (a *App) DuplicateBlock(boardID string, blockID string, userID string, asTemplate bool) ([]*model.Block, error) {
@@ -514,10 +505,6 @@ func (a *App) GetBlockCountsByType() (map[string]int64, error) {
return a.store.GetBlockCountsByType()
}
func (a *App) GetBlocksForBoard(boardID string) ([]*model.Block, error) {
return a.store.GetBlocksForBoard(boardID)
}
func (a *App) notifyBlockChanged(action notify.Action, block *model.Block, oldBlock *model.Block, modifiedByID string) {
// don't notify if notifications service disabled, or block change is generated via system user.
if a.notifications == nil || modifiedByID == model.SystemUserID {