debian-mirror-gitlab/lib/api/user_counts.rb
2021-03-08 18:12:59 +05:30

22 lines
603 B
Ruby

# frozen_string_literal: true
module API
class UserCounts < ::API::Base
feature_category :navigation
resource :user_counts do
desc 'Return the user specific counts' do
detail 'Open MR Count'
end
get do
unauthorized! unless current_user
{
merge_requests: current_user.assigned_open_merge_requests_count, # @deprecated
assigned_merge_requests: current_user.assigned_open_merge_requests_count,
review_requested_merge_requests: current_user.review_requested_open_merge_requests_count
}
end
end
end
end