chore: Campaign ID migration for existing accounts (#2189)

* chore: Campaign ID migration for existing accounts

* chore: update factory

* chore: minor fixes

* chore: fixes
This commit is contained in:
Sojan Jose
2021-04-30 18:45:24 +05:30
committed by GitHub
parent bd7e9d2790
commit a07200bedf
8 changed files with 42 additions and 15 deletions

View File

@@ -23,6 +23,6 @@ class Api::V1::Accounts::CampaignsController < Api::V1::Accounts::BaseController
end
def campaign_params
params.require(:campaign).permit(:title, :description, :content, :enabled, :inbox_id, :sender_id, trigger_rules: {})
params.require(:campaign).permit(:title, :description, :message, :enabled, :inbox_id, :sender_id, trigger_rules: {})
end
end

View File

@@ -3,9 +3,9 @@
# Table name: campaigns
#
# id :bigint not null, primary key
# content :text not null
# description :text
# enabled :boolean default(TRUE)
# message :text not null
# title :string not null
# trigger_rules :jsonb
# created_at :datetime not null
@@ -28,6 +28,8 @@
class Campaign < ApplicationRecord
validates :account_id, presence: true
validates :inbox_id, presence: true
validates :title, presence: true
validates :message, presence: true
belongs_to :account
belongs_to :inbox
belongs_to :sender, class_name: 'User', optional: true

View File

@@ -1,9 +1,6 @@
json.id resource.display_id
json.content resource.content
json.description resource.description
json.enabled resource.enabled
json.title resource.title
json.trigger_rules resource.trigger_rules
json.description resource.description
json.account_id resource.account_id
json.inbox do
json.partial! 'api/v1/models/inbox.json.jbuilder', resource: resource.inbox
@@ -11,5 +8,8 @@ end
json.sender do
json.partial! 'api/v1/models/agent.json.jbuilder', resource: resource.sender if resource.sender.present?
end
json.message resource.message
json.enabled resource.enabled
json.trigger_rules resource.trigger_rules
json.created_at resource.created_at
json.updated_at resource.updated_at