debian-mirror-gitlab/lib/api/user_counts.rb

25 lines
767 B
Ruby
Raw Normal View History

2019-09-30 21:07:59 +05:30
# frozen_string_literal: true
module API
2021-01-03 14:25:43 +05:30
class UserCounts < ::API::Base
2021-01-29 00:20:46 +05:30
feature_category :navigation
2019-09-30 21:07:59 +05:30
resource :user_counts do
desc 'Return the user specific counts' do
2021-10-27 15:23:28 +05:30
detail 'Assigned open issues, assigned MRs and pending todos count'
2019-09-30 21:07:59 +05:30
end
get do
unauthorized! unless current_user
{
2021-03-08 18:12:59 +05:30
merge_requests: current_user.assigned_open_merge_requests_count, # @deprecated
2021-10-27 15:23:28 +05:30
assigned_issues: current_user.assigned_open_issues_count,
2021-03-08 18:12:59 +05:30
assigned_merge_requests: current_user.assigned_open_merge_requests_count,
2021-10-27 15:23:28 +05:30
review_requested_merge_requests: current_user.review_requested_open_merge_requests_count,
todos: current_user.todos_pending_count
2019-09-30 21:07:59 +05:30
}
end
end
end
end