mirror of
https://github.com/internetee/registry.git
synced 2025-06-05 20:27:30 +02:00
Add tests, show papertrail whodunnit properly on repp api
This commit is contained in:
parent
7d08e22f6f
commit
38f86225ca
3 changed files with 28 additions and 3 deletions
|
@ -4,9 +4,10 @@ module Repp
|
|||
rescue_from ActiveRecord::RecordNotFound, with: :not_found_error
|
||||
before_action :authenticate_user
|
||||
before_action :check_ip_restriction
|
||||
before_action :set_paper_trail_whodunnit
|
||||
attr_reader :current_user
|
||||
|
||||
before_action :set_paper_trail_whodunnit
|
||||
|
||||
rescue_from ActionController::ParameterMissing do |exception|
|
||||
render json: { code: 2003, message: exception }, status: :bad_request
|
||||
end
|
||||
|
@ -23,6 +24,10 @@ module Repp
|
|||
|
||||
private
|
||||
|
||||
def set_paper_trail_whodunnit
|
||||
::PaperTrail.request.whodunnit = current_user
|
||||
end
|
||||
|
||||
def render_success(code: nil, message: nil, data: nil)
|
||||
@response = { code: code || 1000, message: message || 'Command completed successfully',
|
||||
data: data || {} }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue