mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-12-05 13:39:04 +01:00
44b2ee3485
* Add customizable user roles * Various fixes and improvements * Add migration for old settings and fix tootctl role management
25 lines
546 B
Ruby
25 lines
546 B
Ruby
# frozen_string_literal: true
|
|
|
|
class Api::V1::Admin::RetentionController < Api::BaseController
|
|
include Authorization
|
|
|
|
before_action -> { authorize_if_got_token! :'admin:read' }
|
|
before_action :set_cohorts
|
|
|
|
after_action :verify_authorized
|
|
|
|
def create
|
|
authorize :dashboard, :index?
|
|
render json: @cohorts, each_serializer: REST::Admin::CohortSerializer
|
|
end
|
|
|
|
private
|
|
|
|
def set_cohorts
|
|
@cohorts = Admin::Metrics::Retention.new(
|
|
params[:start_at],
|
|
params[:end_at],
|
|
params[:frequency]
|
|
).cohorts
|
|
end
|
|
end
|