From f2cee65dee5e38665a18c43c77670afc9fbaaf8c Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Wed, 11 Sep 2024 03:48:49 +0000 Subject: [PATCH] Track changes on api keys --- app/dashboards/api_key_dashboard.rb | 4 +++- app/models/api_key.rb | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/dashboards/api_key_dashboard.rb b/app/dashboards/api_key_dashboard.rb index aad02cdd1..9616311dd 100644 --- a/app/dashboards/api_key_dashboard.rb +++ b/app/dashboards/api_key_dashboard.rb @@ -23,7 +23,8 @@ class ApiKeyDashboard < Administrate::BaseDashboard value: Field::String, created_at: Field::DateTime, updated_at: Field::DateTime, - expires_at: Field::DateTime + expires_at: Field::DateTime, + versions: Field::PaperTrail }.freeze, T::Hash[Symbol, T.untyped]) # COLLECTION_ATTRIBUTES @@ -53,6 +54,7 @@ class ApiKeyDashboard < Administrate::BaseDashboard daily_limit created_at updated_at + versions ].freeze, T::Array[Symbol]) # FORM_ATTRIBUTES diff --git a/app/models/api_key.rb b/app/models/api_key.rb index 265aac16e..9e50976fb 100644 --- a/app/models/api_key.rb +++ b/app/models/api_key.rb @@ -6,6 +6,7 @@ class ApiKey < ApplicationRecord belongs_to :user has_many :daily_api_usages, dependent: :destroy + has_paper_trail validates :value, uniqueness: true