app/services/alerts/delete_content_generation_run_service.rb
module Alerts
class DeleteContentGenerationRunService
DEFAULT_OLDER_THAN = 1.month.ago.beginning_of_month
attr_reader :older_than
def initialize(older_than = DEFAULT_OLDER_THAN)
@older_than = older_than
end
def delete!
content_generation_runs = ContentGenerationRun.where('created_at <= ?', @older_than)
content_generation_runs.destroy_all
end
end
end