mirror of
https://github.com/we-promise/sure.git
synced 2026-05-12 23:25:00 +00:00
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:
27
app/views/api/v1/rule_runs/_rule_run.json.jbuilder
Normal file
27
app/views/api/v1/rule_runs/_rule_run.json.jbuilder
Normal 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
|
||||
16
app/views/api/v1/rule_runs/index.json.jbuilder
Normal file
16
app/views/api/v1/rule_runs/index.json.jbuilder
Normal 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
|
||||
5
app/views/api/v1/rule_runs/show.json.jbuilder
Normal file
5
app/views/api/v1/rule_runs/show.json.jbuilder
Normal file
@@ -0,0 +1,5 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
json.data do
|
||||
json.partial! "rule_run", rule_run: @rule_run
|
||||
end
|
||||
Reference in New Issue
Block a user