Add account to antenna webui

This commit is contained in:
KMY 2023-04-25 10:30:30 +09:00
parent 69df23d8d9
commit 0d5a6adc43
20 changed files with 644 additions and 1 deletions

View file

@ -14,4 +14,6 @@ class AntennaAccount < ApplicationRecord
belongs_to :antenna
belongs_to :account
validates :account_id, uniqueness: { scope: :antenna_id }
end

View file

@ -48,6 +48,10 @@ module AccountAssociations
has_many :account_warnings, dependent: :destroy, inverse_of: :account
has_many :strikes, class_name: 'AccountWarning', foreign_key: :target_account_id, dependent: :destroy, inverse_of: :target_account
# Antennas (that the account is on, not owned by the account)
has_many :antenna_accounts, inverse_of: :account, dependent: :destroy
has_many :joined_antennas, class_name: 'Antenna', through: :antenna_accounts, source: :antenna
# Lists (that the account is on, not owned by the account)
has_many :list_accounts, inverse_of: :account, dependent: :destroy
has_many :lists, through: :list_accounts