2020-08-10 06:45:29 +00:00
|
|
|
class Api::V1::Accounts::Contacts::ContactInboxesController < Api::V1::Accounts::BaseController
|
|
|
|
before_action :ensure_contact
|
|
|
|
before_action :ensure_inbox, only: [:create]
|
|
|
|
|
|
|
|
def create
|
|
|
|
source_id = params[:source_id] || SecureRandom.uuid
|
2021-02-03 13:54:51 +00:00
|
|
|
@contact_inbox = ContactInbox.create!(contact: @contact, inbox: @inbox, source_id: source_id)
|
2020-08-10 06:45:29 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def ensure_inbox
|
|
|
|
@inbox = Current.account.inboxes.find(params[:inbox_id])
|
|
|
|
end
|
|
|
|
|
|
|
|
def ensure_contact
|
|
|
|
@contact = Current.account.contacts.find(params[:contact_id])
|
|
|
|
end
|
|
|
|
end
|