module Api module V1 module Admin class TrainingWatchHitsController < BaseController before_action :set_hit, only: %i[show destroy] def index = render json: TrainingWatchHit.includes(:training_watch_source).order(created_at: :desc).limit(1_000).map { |hit| hit.as_json.merge(source_name: hit.training_watch_source.name) } def show = render json: @hit.as_json.merge(source_name: @hit.training_watch_source.name) def destroy @hit.destroy! head :no_content end private def set_hit = @hit = TrainingWatchHit.find(params[:id]) end end end end