Sha256: f69d9ea2998197a2aae125591a713e047f49590d958095c6348c28e30c069207

Contents?: true

Size: 701 Bytes

Versions: 1

Compression:

Stored size: 701 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
restpack_activity_service-0.0.13 lib/restpack_activity_service/commands/activity/list.rb