2024-12-07 17:30:25 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module ::DiscourseRewind
|
|
|
|
class RewindsController < ::ApplicationController
|
|
|
|
requires_plugin PLUGIN_NAME
|
|
|
|
|
|
|
|
def show
|
2024-12-07 18:40:23 +01:00
|
|
|
DiscourseRewind::Rewind::Fetch.call(service_params) do
|
2025-01-13 17:00:32 +01:00
|
|
|
on_model_not_found(:year) { raise Discourse::NotFound }
|
|
|
|
on_model_not_found(:user) { raise Discourse::NotFound }
|
2024-12-07 18:40:23 +01:00
|
|
|
on_success do |reports:|
|
|
|
|
@reports = reports
|
2024-12-13 17:00:17 +01:00
|
|
|
render json: MultiJson.dump(reports), status: 200
|
2024-12-07 18:40:23 +01:00
|
|
|
end
|
|
|
|
end
|
2024-12-07 17:30:25 +01:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|