Sha256: c2ab83ade3f722e9f8f85b341ade2e3df32f60286e3f9a621ff686fd3fba5334

Contents?: true

Size: 704 Bytes

Versions: 4

Compression:

Stored size: 704 Bytes

Contents

module RestPack::Activity::Service::Commands::Activity
  class List < RestPack::Service::Command
    required do
      integer :application_id
    end

    optional do
      integer :user_id
      integer :page
      integer :page_size
      string  :tags
      string  :access
      string  :query
    end

    def execute
      scope = Models::Activity.all
      scope = scope.where(application_id: application_id)

      scope = scope.where(user_id: user_id) if user_id
      scope = scope.all_tags_csv(tags) if tags
      scope = scope.any_tags_csv(access, :access) if access
      scope = scope.search(query) if query

      Serializers::ActivitySerializer.resource(inputs, scope)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
restpack_activity_service-0.0.10 lib/restpack_activity_service/services/activity/list.rb
restpack_activity_service-0.0.9 lib/restpack_activity_service/services/activity/list.rb
restpack_activity_service-0.0.8 lib/restpack_activity_service/services/activity/list.rb
restpack_activity_service-0.0.7 lib/restpack_activity_service/services/activity/list.rb