admin/app/controllers/workarea/api/admin/content_controller.rb in workarea-api-4.4.7 vs admin/app/controllers/workarea/api/admin/content_controller.rb in workarea-api-4.5.0
- old
+ new
@@ -33,10 +33,14 @@
key :description, 'Direction for sort by'
key :type, :string
key :enum, %w(asc desc)
key :default, 'desc'
end
+ parameter :updated_at_starts_at
+ parameter :updated_at_ends_at
+ parameter :created_at_starts_at
+ parameter :created_at_ends_at
response 200 do
key :description, 'Content'
schema do
key :type, :object
@@ -95,9 +99,11 @@
end
def index
@content = Content
.all
+ .by_updated_at(starts_at: params[:updated_at_starts_at], ends_at: params[:updated_at_ends_at])
+ .by_created_at(starts_at: params[:created_at_starts_at], ends_at: params[:created_at_ends_at])
.order_by(sort_field => sort_direction)
.page(params[:page])
respond_with content: @content
end