Sha256: 7de5427b6da884389e5c34b63c283638aae37099814a55cf7a8e62cc209ea257

Contents?: true

Size: 752 Bytes

Versions: 2

Compression:

Stored size: 752 Bytes

Contents

module RestPack::Activity::Service::Commands
  module 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::Activity.resource(inputs, scope)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
restpack_activity_service-0.0.12 lib/restpack_activity_service/commands/activity/list.rb
restpack_activity_service-0.0.11 lib/restpack_activity_service/commands/activity/list.rb