Sha256: 4754719486e5973585cf2d7c6e522d987183eab698184180f99b94038a39eb44
Contents?: true
Size: 1011 Bytes
Versions: 1
Compression:
Stored size: 1011 Bytes
Contents
module RestPack::Group::Service::Commands module Group class List < RestPack::Service::Command required do integer :application_id end optional do integer :account_id integer :created_by boolean :is_account_group, default: false integer :page integer :page_size end def execute # TODO: GJ: remove the scope when we can specify custom serializer filters # https://github.com/RestPack/restpack_serializer/issues/42 scope = Models::Group.all scope = scope.where(application_id: application_id) scope = scope.where(account_id: account_id) if account_id scope = scope.where(created_by: created_by) if created_by if is_account_group scope = scope.where("account_id IS NOT NULL") else scope = scope.where("account_id IS NULL") unless account_id end Serializers::Group.resource(inputs, scope) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
restpack_group_service-0.0.5 | lib/restpack_group_service/commands/group/list.rb |