Sha256: dc43ea39891baa55712c2b4c3418ffd69349920ac408a501773b504eb7dc9fd4

Contents?: true

Size: 655 Bytes

Versions: 2

Compression:

Stored size: 655 Bytes

Contents

module RestPack::User::Service::Commands::User
  class Get < RestPack::Service::Command
    required do
      integer :id
      integer :application_id
    end

    def execute
      #TODO: GJ: remove the :application_id scope when we can specify custom serializer filters
      #          https://github.com/RestPack/restpack_serializer/issues/42
      result = RestPack::User::Service::Serializers::UserSerializer.resource(
        inputs,
        RestPack::User::Service::Models::User.where(application_id: inputs[:application_id])
      )

      if result[:users].empty?
        status :not_found
      else
        result
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
restpack_user_service-0.0.3 lib/restpack_user_service/commands/user/get.rb
restpack_user_service-0.0.2 lib/restpack_user_service/commands/user/get.rb