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 удалений

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

@@ -105,23 +105,6 @@ func (s *SQLStore) getBlocks(db sq.BaseRunner, opts model.QueryBlocksOptions) ([
return s.blocksFromRows(rows)
}
func (s *SQLStore) getBlocksWithParentAndType(db sq.BaseRunner, boardID, parentID string, blockType string) ([]*model.Block, error) {
opts := model.QueryBlocksOptions{
BoardID: boardID,
ParentID: parentID,
BlockType: model.BlockType(blockType),
}
return s.getBlocks(db, opts)
}
func (s *SQLStore) getBlocksWithParent(db sq.BaseRunner, boardID, parentID string) ([]*model.Block, error) {
opts := model.QueryBlocksOptions{
BoardID: boardID,
ParentID: parentID,
}
return s.getBlocks(db, opts)
}
func (s *SQLStore) getBlocksByIDs(db sq.BaseRunner, ids []string) ([]*model.Block, error) {
query := s.getQueryBuilder(db).
Select(s.blockFields("")...).
@@ -148,14 +131,6 @@ func (s *SQLStore) getBlocksByIDs(db sq.BaseRunner, ids []string) ([]*model.Bloc
return blocks, nil
}
func (s *SQLStore) getBlocksWithType(db sq.BaseRunner, boardID, blockType string) ([]*model.Block, error) {
opts := model.QueryBlocksOptions{
BoardID: boardID,
BlockType: model.BlockType(blockType),
}
return s.getBlocks(db, opts)
}
// getSubTree2 returns blocks within 2 levels of the given blockID.
func (s *SQLStore) getSubTree2(db sq.BaseRunner, boardID string, blockID string, opts model.QuerySubtreeOptions) ([]*model.Block, error) {
query := s.getQueryBuilder(db).
@@ -188,13 +163,6 @@ func (s *SQLStore) getSubTree2(db sq.BaseRunner, boardID string, blockID string,
return s.blocksFromRows(rows)
}
func (s *SQLStore) getBlocksForBoard(db sq.BaseRunner, boardID string) ([]*model.Block, error) {
opts := model.QueryBlocksOptions{
BoardID: boardID,
}
return s.getBlocks(db, opts)
}
func (s *SQLStore) blocksFromRows(rows *sql.Rows) ([]*model.Block, error) {
results := []*model.Block{}

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

@@ -166,7 +166,7 @@ func (s *SQLStore) duplicateBoard(db sq.BaseRunner, boardID string, userID strin
}
bab.Boards = []*model.Board{board}
blocks, err := s.getBlocksForBoard(db, boardID)
blocks, err := s.getBlocks(db, model.QueryBlocksOptions{BoardID: boardID})
if err != nil {
return nil, nil, err
}

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

@@ -326,26 +326,6 @@ func (s *SQLStore) GetBlocksComplianceHistory(opts model.QueryBlocksComplianceHi
}
func (s *SQLStore) GetBlocksForBoard(boardID string) ([]*model.Block, error) {
return s.getBlocksForBoard(s.db, boardID)
}
func (s *SQLStore) GetBlocksWithParent(boardID string, parentID string) ([]*model.Block, error) {
return s.getBlocksWithParent(s.db, boardID, parentID)
}
func (s *SQLStore) GetBlocksWithParentAndType(boardID string, parentID string, blockType string) ([]*model.Block, error) {
return s.getBlocksWithParentAndType(s.db, boardID, parentID, blockType)
}
func (s *SQLStore) GetBlocksWithType(boardID string, blockType string) ([]*model.Block, error) {
return s.getBlocksWithType(s.db, boardID, blockType)
}
func (s *SQLStore) GetBoard(id string) (*model.Board, error) {
return s.getBoard(s.db, id)