diff options
author | charlieablett <cablett@gitlab.com> | 2019-06-14 10:20:03 +1200 |
---|---|---|
committer | charlieablett <cablett@gitlab.com> | 2019-06-26 11:47:18 +1200 |
commit | 426f1c20b19e5bd98ee0ab8bd5f8851b683a79c6 (patch) | |
tree | 14dfe36a0f72fa5fee258f7a89f94c74be6720f4 /lib | |
parent | 4633df7b9e756ae50f35246e9ba93e1c3ca1e01a (diff) | |
download | gitlab-ce-426f1c20b19e5bd98ee0ab8bd5f8851b683a79c6.tar.gz |
Remove N+1 query for project and group boards
- Add test for N+1 queries
- Add destroyable lists scope to Board and List
- Preload lists for both project and group boards
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/boards.rb | 2 | ||||
-rw-r--r-- | lib/api/boards_responses.rb | 2 | ||||
-rw-r--r-- | lib/api/entities.rb | 2 | ||||
-rw-r--r-- | lib/api/group_boards.rb | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/lib/api/boards.rb b/lib/api/boards.rb index b7c77730afb..4e31f74f18a 100644 --- a/lib/api/boards.rb +++ b/lib/api/boards.rb @@ -27,7 +27,7 @@ module API end get '/' do authorize!(:read_board, user_project) - present paginate(board_parent.boards), with: Entities::Board + present paginate(board_parent.boards.with_associations), with: Entities::Board end desc 'Find a project board' do diff --git a/lib/api/boards_responses.rb b/lib/api/boards_responses.rb index 86d9b24802f..68497a08fb8 100644 --- a/lib/api/boards_responses.rb +++ b/lib/api/boards_responses.rb @@ -11,7 +11,7 @@ module API end def board_lists - board.lists.destroyable + board.destroyable_lists end def create_list diff --git a/lib/api/entities.rb b/lib/api/entities.rb index ead01dc53f7..d783591c238 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -1101,7 +1101,7 @@ module API expose :project, using: Entities::BasicProjectDetails expose :lists, using: Entities::List do |board| - board.lists.destroyable + board.destroyable_lists end end diff --git a/lib/api/group_boards.rb b/lib/api/group_boards.rb index 9a20ee8c8b9..feb2254963e 100644 --- a/lib/api/group_boards.rb +++ b/lib/api/group_boards.rb @@ -37,7 +37,7 @@ module API use :pagination end get '/' do - present paginate(board_parent.boards), with: Entities::Board + present paginate(board_parent.boards.with_associations), with: Entities::Board end end |