-
Notifications
You must be signed in to change notification settings - Fork 9
Nested operation Sorting
Vladislav Trotsenko edited this page Sep 30, 2019
·
2 revisions
Provides JSON API sorting.
HTTP request example: GET /users?sort=name,-age
Before using this nested operation you should set ctx[:available_columns]
with ColumnsBuilder
:
module Api::V1::Lib::Operation
class Sorting < ApplicationOperation
step :sort_params_passed?, Output(:failure) => End(:success)
step Macro::Contract::Schema(Api::V1::Lib::Contract::SortingPreValidation, name: :uri_query)
step Contract::Validate(name: :uri_query)
step :set_validation_dependencies
step Macro::Contract::Schema(
Api::V1::Lib::Contract::SortingValidation,
inject: %i[available_sortable_columns],
name: :uri_query
)
step Contract::Validate(name: :uri_query), id: :sorting_validation
step :order_options
end
end
RubyGarage is a leading software development and consulting company in Eastern Europe. Our main expertise includes Ruby and Ruby on Rails, but we successfully employ other technologies to deliver the best results to our clients. Check out our portfolio for even more exciting works!