Skip to content

Commit 15fd9c7

Browse files
authored
Merge branch 'main' into optimize-snapshot-controller
2 parents d833c9c + e252696 commit 15fd9c7

File tree

61 files changed

+65
-42
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+65
-42
lines changed

app/controllers/application_controller.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,9 @@ class UnauthorizedError < StandardError; end
1111
register_exception BadDeckError, status: 400
1212
register_exception UnauthorizedError, status: 403
1313
register_exception UnauthorizedError, status: 403
14+
15+
def add_total_stat(params)
16+
params['stats'] = {} unless params.include?('stats')
17+
params['stats']['total'] = 'count'
18+
end
1419
end

app/controllers/card_cycles_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Controller for the CardCycle resource.
44
class CardCyclesController < ApplicationController
55
def index
6+
add_total_stat(params)
67
card_cycles = CardCycleResource.all(params)
78
respond_with(card_cycles)
89
end

app/controllers/card_pools_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Controller for the CardPool resource.
44
class CardPoolsController < ApplicationController
55
def index
6+
add_total_stat(params)
67
base_scope = CardPool.includes(:cards)
78
card_pools = CardPoolResource.all(params, base_scope)
89
respond_with(card_pools)

app/controllers/card_set_types_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Controller for the CardSetType resource.
44
class CardSetTypesController < ApplicationController
55
def index
6+
add_total_stat(params)
67
card_set_types = CardSetTypeResource.all(params)
78
respond_with(card_set_types)
89
end

app/controllers/card_sets_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Controller for the CardSet resource.
44
class CardSetsController < ApplicationController
55
def index
6+
add_total_stat(params)
67
card_sets = CardSetResource.all(params)
78
respond_with(card_sets)
89
end

app/controllers/card_subtypes_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Controller for the CardSubtype resource.
44
class CardSubtypesController < ApplicationController
55
def index
6+
add_total_stat(params)
67
card_subtypes = CardSubtypeResource.all(params)
78
respond_with(card_subtypes)
89
end

app/controllers/card_types_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Controller for the CardType resource.
44
class CardTypesController < ApplicationController
55
def index
6+
add_total_stat(params)
67
card_types = CardTypeResource.all(params)
78
respond_with(card_types)
89
end

app/controllers/cards_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Controller for the Card resource.
44
class CardsController < ApplicationController
55
def index
6+
add_total_stat(params)
67
cards = CardResource.all(params)
78
respond_with(cards)
89
end

app/controllers/decklists_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Controller for the decklist resource.
44
class DecklistsController < ApplicationController
55
def index
6+
add_total_stat(params)
67
base_scope = Decklist.includes(:identity_card, :cards)
78
decklists = DecklistResource.all(params, base_scope)
89
respond_with(decklists)

app/controllers/decks_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ class DecksController < ApplicationController
55
include JwtAuthorizationConcern
66

77
def index
8+
add_total_stat(params)
89
base_scope = Deck.where(user_id: @current_user.id)
910
params[:filter].delete(:user_id) if params.include?(:filter)
1011
decks = DeckResource.all(params, base_scope)

0 commit comments

Comments
 (0)