trust audit api

This commit is contained in:
Echo 2025-08-11 00:12:54 -04:00
parent e60f75070a
commit e932e46cb8
No known key found for this signature in database
GPG key ID: A1263DC479EDB62F

View file

@ -243,6 +243,30 @@ module Api
end
end
def trust_logs
user = find_user_by_id
return unless user
logs = TrustLevelAuditLog.for_user(user).recent.limit(25)
render json: {
trust_logs: logs.map do |log|
{
id: log.id,
previous_trust_level: log.previous_trust_level,
new_trust_level: log.new_trust_level,
changed_by: {
id: log.changed_by.id,
username: log.changed_by.username,
display_name: log.changed_by.display_name,
admin_level: log.changed_by.admin_level
},
reason: log.reason,
notes: log.notes,
created_at: log.created_at
}
end
}
end
private
def find_user_by_id