Skip to content

Commit

Permalink
ensure order by id
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanwoldatwork committed Nov 22, 2024
1 parent 9092696 commit 5bdded4
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/controllers/api/v1/digital_products_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ def index

@total_count = DigitalProduct.active.count
@digital_products = DigitalProduct.active
.order(:id)
.limit(size)
.offset(size * page)
.order(:id)

render json: @digital_products,
meta: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ def index
@total_count = DigitalServiceAccount.active.count

@digital_service_accounts = DigitalServiceAccount.active
.order(:id)
.limit(size)
.offset(size * page)
.order(:id)

render json: @digital_service_accounts,
meta: {
Expand Down
8 changes: 6 additions & 2 deletions app/controllers/api/v1/forms_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ def index
respond_to do |format|
format.json do
if current_user.organizational_admin?
render json: current_user.organization.forms.limit(100), each_serializer: FormSerializer
render json: current_user.organization.forms
.order(:id)
.limit(100), each_serializer: FormSerializer
else
render json: current_user.forms.limit(100), each_serializer: FormSerializer
render json: current_user.forms
.order(:id)
.limit(100), each_serializer: FormSerializer
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/personas_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class PersonasController < ::ApiController
def index
respond_to do |format|
format.json do
render json: Persona.all, each_serializer: PersonaSerializer
render json: Persona.order(:id), each_serializer: PersonaSerializer
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/service_providers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ServiceProvidersController < ::ApiController
def index
respond_to do |format|
format.json do
render json: ServiceProvider.includes(:organization).order('organizations.name', :name), each_serializer: ServiceProviderSerializer
render json: ServiceProvider.includes(:organization).order(:id, 'organizations.name', :name), each_serializer: ServiceProviderSerializer
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/services_stages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ServicesStagesController < ::ApiController
def index
respond_to do |format|
format.json do
render json: ServiceStage.order(:service_id, :position_id), each_serializer: ServiceStageSerializer
render json: ServiceStage.order(:id), each_serializer: ServiceStageSerializer
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/api/v1/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class UsersController < ::ApiController
def index
respond_to do |format|
format.json do
render json: User.active, each_serializer: UserSerializer
render json: User.active.order(:id), each_serializer: UserSerializer
end
end
end
Expand Down

0 comments on commit 5bdded4

Please sign in to comment.