2018-12-13 19:26:56 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module API
|
2020-10-15 00:08:42 +00:00
|
|
|
class ProjectStatistics < ::API::Base
|
2020-10-30 18:08:56 +00:00
|
|
|
feature_category :source_code_management
|
|
|
|
|
2018-12-13 19:26:56 +00:00
|
|
|
before do
|
|
|
|
authenticate!
|
|
|
|
authorize! :daily_statistics, user_project
|
|
|
|
end
|
|
|
|
|
|
|
|
params do
|
2022-11-03 15:11:31 +00:00
|
|
|
requires :id, types: [String, Integer], desc: 'The ID or URL-encoded path of the project'
|
2018-12-13 19:26:56 +00:00
|
|
|
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
|