feat: Add Platform APIs (#1456)
This commit is contained in:
@@ -32,7 +32,6 @@ class Inbox < ApplicationRecord
|
||||
|
||||
belongs_to :account
|
||||
|
||||
# TODO: should add associations for the channel types
|
||||
belongs_to :channel, polymorphic: true, dependent: :destroy
|
||||
|
||||
has_many :contact_inboxes, dependent: :destroy
|
||||
|
||||
16
app/models/platform_app.rb
Normal file
16
app/models/platform_app.rb
Normal file
@@ -0,0 +1,16 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: platform_apps
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# name :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
class PlatformApp < ApplicationRecord
|
||||
include AccessTokenable
|
||||
|
||||
validates :name, presence: true
|
||||
|
||||
has_many :platform_app_permissibles, dependent: :destroy
|
||||
end
|
||||
26
app/models/platform_app_permissible.rb
Normal file
26
app/models/platform_app_permissible.rb
Normal file
@@ -0,0 +1,26 @@
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: platform_app_permissibles
|
||||
#
|
||||
# id :bigint not null, primary key
|
||||
# permissible_type :string not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
# permissible_id :bigint not null
|
||||
# platform_app_id :bigint not null
|
||||
#
|
||||
# Indexes
|
||||
#
|
||||
# index_platform_app_permissibles_on_permissibles (permissible_type,permissible_id)
|
||||
# index_platform_app_permissibles_on_platform_app_id (platform_app_id)
|
||||
# unique_permissibles_index (platform_app_id,permissible_id,permissible_type) UNIQUE
|
||||
#
|
||||
class PlatformAppPermissible < ApplicationRecord
|
||||
include AccessTokenable
|
||||
|
||||
validates :platform_app, presence: true
|
||||
validates :platform_app_id, uniqueness: { scope: [:permissible_id, :permissible_type] }
|
||||
|
||||
belongs_to :platform_app
|
||||
belongs_to :permissible, polymorphic: true, dependent: :destroy
|
||||
end
|
||||
Reference in New Issue
Block a user