Expose number_projects and number_users for groups endpoint

This commit is contained in:
Alfredo Sumaran 2017-05-30 04:24:51 -05:00
parent d15521c79d
commit a9921e9d5d
1 changed files with 9 additions and 0 deletions

View File

@ -1,4 +1,5 @@
class GroupEntity < Grape::Entity
include ActionView::Helpers::NumberHelper
include RequestAwareEntity
include MembersHelper
@ -30,4 +31,12 @@ class GroupEntity < Grape::Entity
expose :has_subgroups do |group|
group.children.any?
end
expose :number_projects do |group|
number_with_delimiter(group.projects.non_archived.count)
end
expose :number_users do |group|
number_with_delimiter(group.users.count)
end
end