From 646d0bf749afee1483f85d99cf3899fe2109283d Mon Sep 17 00:00:00 2001 From: Sojan Jose Date: Mon, 23 Mar 2026 21:23:30 -0700 Subject: [PATCH] fix: preserve annotaterb output and cover installation config defaults --- .annotaterb.yml | 4 +-- app/models/csat_survey_response.rb | 34 ++++++++++++++----------- app/models/reporting_event.rb | 15 ++++++----- app/models/reporting_events_rollup.rb | 22 ++++++++-------- app/models/webhook.rb | 1 + spec/models/installation_config_spec.rb | 12 +++++++++ 6 files changed, 53 insertions(+), 35 deletions(-) diff --git a/.annotaterb.yml b/.annotaterb.yml index 112e4f381..07162a22d 100644 --- a/.annotaterb.yml +++ b/.annotaterb.yml @@ -41,8 +41,8 @@ :active_admin: false :command: :debug: false -:hide_default_column_types: '' -:hide_limit_column_types: '' +:hide_default_column_types: json,jsonb,hstore +:hide_limit_column_types: integer,bigint,boolean :timestamp_columns: - created_at - updated_at diff --git a/app/models/csat_survey_response.rb b/app/models/csat_survey_response.rb index 804dfd4b7..212530493 100644 --- a/app/models/csat_survey_response.rb +++ b/app/models/csat_survey_response.rb @@ -2,24 +2,28 @@ # # Table name: csat_survey_responses # -# id :bigint not null, primary key -# feedback_message :text -# rating :integer not null -# created_at :datetime not null -# updated_at :datetime not null -# account_id :bigint not null -# assigned_agent_id :bigint -# contact_id :bigint not null -# conversation_id :bigint not null -# message_id :bigint not null +# id :bigint not null, primary key +# csat_review_notes :text +# feedback_message :text +# rating :integer not null +# review_notes_updated_at :datetime +# created_at :datetime not null +# updated_at :datetime not null +# account_id :bigint not null +# assigned_agent_id :bigint +# contact_id :bigint not null +# conversation_id :bigint not null +# message_id :bigint not null +# review_notes_updated_by_id :bigint # # Indexes # -# index_csat_survey_responses_on_account_id (account_id) -# index_csat_survey_responses_on_assigned_agent_id (assigned_agent_id) -# index_csat_survey_responses_on_contact_id (contact_id) -# index_csat_survey_responses_on_conversation_id (conversation_id) -# index_csat_survey_responses_on_message_id (message_id) UNIQUE +# index_csat_survey_responses_on_account_id (account_id) +# index_csat_survey_responses_on_assigned_agent_id (assigned_agent_id) +# index_csat_survey_responses_on_contact_id (contact_id) +# index_csat_survey_responses_on_conversation_id (conversation_id) +# index_csat_survey_responses_on_message_id (message_id) UNIQUE +# index_csat_survey_responses_on_review_notes_updated_by_id (review_notes_updated_by_id) # class CsatSurveyResponse < ApplicationRecord belongs_to :account diff --git a/app/models/reporting_event.rb b/app/models/reporting_event.rb index f083e32a1..6c2c10b01 100644 --- a/app/models/reporting_event.rb +++ b/app/models/reporting_event.rb @@ -17,13 +17,14 @@ # # Indexes # -# index_reporting_events_on_account_id (account_id) -# index_reporting_events_on_conversation_id (conversation_id) -# index_reporting_events_on_created_at (created_at) -# index_reporting_events_on_inbox_id (inbox_id) -# index_reporting_events_on_name (name) -# index_reporting_events_on_user_id (user_id) -# reporting_events__account_id__name__created_at (account_id,name,created_at) +# index_reporting_events_for_response_distribution (account_id,name,inbox_id,created_at) +# index_reporting_events_on_account_id (account_id) +# index_reporting_events_on_conversation_id (conversation_id) +# index_reporting_events_on_created_at (created_at) +# index_reporting_events_on_inbox_id (inbox_id) +# index_reporting_events_on_name (name) +# index_reporting_events_on_user_id (user_id) +# reporting_events__account_id__name__created_at (account_id,name,created_at) # class ReportingEvent < ApplicationRecord diff --git a/app/models/reporting_events_rollup.rb b/app/models/reporting_events_rollup.rb index a9e345cba..9ad1b5135 100644 --- a/app/models/reporting_events_rollup.rb +++ b/app/models/reporting_events_rollup.rb @@ -2,17 +2,17 @@ # # Table name: reporting_events_rollups # -# id :bigint not null, primary key -# count :bigint default(0), not null -# date :date not null -# dimension_id :bigint not null -# dimension_type :string not null -# metric :string not null -# sum_value :float default(0.0), not null -# sum_value_business_hours :float default(0.0), not null -# created_at :datetime not null -# updated_at :datetime not null -# account_id :integer not null +# id :bigint not null, primary key +# count :bigint default(0), not null +# date :date not null +# dimension_type :string not null +# metric :string not null +# sum_value :float default(0.0), not null +# sum_value_business_hours :float default(0.0), not null +# created_at :datetime not null +# updated_at :datetime not null +# account_id :integer not null +# dimension_id :bigint not null # # Indexes # diff --git a/app/models/webhook.rb b/app/models/webhook.rb index 6b36c4bbd..9586e1053 100644 --- a/app/models/webhook.rb +++ b/app/models/webhook.rb @@ -4,6 +4,7 @@ # # id :bigint not null, primary key # name :string +# secret :string # subscriptions :jsonb # url :text # webhook_type :integer default("account_type") diff --git a/spec/models/installation_config_spec.rb b/spec/models/installation_config_spec.rb index 49270f2a8..49b58f79e 100644 --- a/spec/models/installation_config_spec.rb +++ b/spec/models/installation_config_spec.rb @@ -3,5 +3,17 @@ require 'rails_helper' RSpec.describe InstallationConfig do + subject(:installation_config) { described_class.new(name: 'INSTALLATION_NAME') } + it { is_expected.to validate_presence_of(:name) } + + describe 'new record defaults' do + it 'initializes serialized_value with indifferent access' do + expect(installation_config.serialized_value).to eq({}.with_indifferent_access) + end + + it 'returns nil for value before assignment' do + expect(installation_config.value).to be_nil + end + end end