Welcome to mirror list, hosted at ThFree Co, Russian Federation.

project_statistics.rb « api « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 2196801096fcd8675ca19a6a4596c3b06c1e3011 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

module API
  class ProjectStatistics < Grape::API::Instance
    before do
      authenticate!
      authorize! :daily_statistics, user_project
    end

    params do
      requires :id, type: String, desc: 'The ID of a project'
    end
    resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
      desc 'Get the list of project fetch statistics for the last 30 days'
      get ":id/statistics" do
        statistic_finder = ::Projects::DailyStatisticsFinder.new(user_project)

        present statistic_finder, with: Entities::ProjectDailyStatistics
      end
    end
  end
end