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

@@ -216,6 +216,28 @@ class Api::V1::BaseController < ApplicationController
value.to_s.match?(UUID_PATTERN)
end
def safe_page_param
page = params[:page].to_i
page > 0 ? page : 1
end
def safe_per_page_param
per_page = params[:per_page].to_i
case per_page
when 1..100 then per_page
when (101..) then 100
else 25
end
end
def render_validation_error(message)
render_json({
error: "validation_failed",
message: message,
errors: [ message ]
}, status: :unprocessable_entity)
end
# Error handlers
def handle_not_found(exception)
Rails.logger.warn "API Record Not Found: #{exception.message}"