2019-07-09 04:44:19 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module API
|
2020-10-14 20:08:42 -04:00
|
|
|
class UserCounts < ::API::Base
|
2020-10-30 14:08:56 -04:00
|
|
|
feature_category :navigation
|
|
|
|
|
2019-07-09 04:44:19 -04:00
|
|
|
resource :user_counts do
|
|
|
|
desc 'Return the user specific counts' do
|
2021-07-30 17:10:15 -04:00
|
|
|
detail 'Assigned open issues, assigned MRs and pending todos count'
|
2019-07-09 04:44:19 -04:00
|
|
|
end
|
|
|
|
get do
|
|
|
|
unauthorized! unless current_user
|
|
|
|
|
|
|
|
{
|
2021-01-04 19:10:20 -05:00
|
|
|
merge_requests: current_user.assigned_open_merge_requests_count, # @deprecated
|
2021-07-30 17:10:15 -04:00
|
|
|
assigned_issues: current_user.assigned_open_issues_count,
|
2021-01-04 19:10:20 -05:00
|
|
|
assigned_merge_requests: current_user.assigned_open_merge_requests_count,
|
2021-07-30 17:10:15 -04:00
|
|
|
review_requested_merge_requests: current_user.review_requested_open_merge_requests_count,
|
|
|
|
todos: current_user.todos_pending_count
|
2019-07-09 04:44:19 -04:00
|
|
|
}
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|