feat(api): expose rule run history (#1646)

* feat(api): expose rule run history

* fix(api): address rule run review

* fix(api): complete rule run review

* test(api): cover unauthenticated rule run show

* test(api): align rule run api key helper

* Small Sonnet nit-pick

---------

Co-authored-by: Juan José Mata <jjmata@jjmata.com>
This commit is contained in:
ghost
2026-05-03 15:33:35 -06:00
committed by GitHub
parent e93b1f1fd7
commit 9cb3b8e05c
11 changed files with 843 additions and 23 deletions

View File

@@ -0,0 +1,27 @@
# frozen_string_literal: true
json.id rule_run.id
json.rule_id rule_run.rule_id
json.rule_name rule_run.rule_name
json.execution_type rule_run.execution_type
json.status rule_run.status
json.transactions_queued rule_run.transactions_queued
json.transactions_processed rule_run.transactions_processed
json.transactions_modified rule_run.transactions_modified
json.pending_jobs_count rule_run.pending_jobs_count
json.executed_at rule_run.executed_at.iso8601
json.error_message rule_run.error_message
if rule_run.rule
json.rule do
json.id rule_run.rule.id
json.name rule_run.rule.name
json.resource_type rule_run.rule.resource_type
json.active rule_run.rule.active
end
else
json.rule nil
end
json.created_at rule_run.created_at.iso8601
json.updated_at rule_run.updated_at.iso8601

View File

@@ -0,0 +1,16 @@
# frozen_string_literal: true
json.data do
json.array! @rule_runs do |rule_run|
json.partial! "rule_run", rule_run: rule_run
end
end
json.meta do
json.current_page @pagy.page
json.next_page @pagy.next
json.prev_page @pagy.prev
json.total_pages @pagy.pages
json.total_count @pagy.count
json.per_page @per_page
end

View File

@@ -0,0 +1,5 @@
# frozen_string_literal: true
json.data do
json.partial! "rule_run", rule_run: @rule_run
end