Add antenna editor page

This commit is contained in:
KMY 2023-08-19 09:31:45 +09:00
parent 87a8da93e8
commit f99dde6df1
25 changed files with 1187 additions and 122 deletions

View file

@ -1,13 +1,18 @@
# frozen_string_literal: true
class Api::V1::Antennas::AccountsController < Api::BaseController
# before_action -> { doorkeeper_authorize! :read, :'read:lists' }, only: [:show]
before_action -> { doorkeeper_authorize! :write, :'write:lists' } # , except: [:show]
before_action -> { doorkeeper_authorize! :read, :'read:lists' }, only: [:show]
before_action -> { doorkeeper_authorize! :write, :'write:lists' }, except: [:show]
before_action :require_user!
before_action :set_antenna
# after_action :insert_pagination_headers, only: :show
after_action :insert_pagination_headers, only: :show
def show
@accounts = load_accounts
render json: @accounts, each_serializer: REST::AccountSerializer
end
def create
ApplicationRecord.transaction do
@ -32,6 +37,14 @@ class Api::V1::Antennas::AccountsController < Api::BaseController
@antenna = Antenna.where(account: current_account).find(params[:antenna_id])
end
def load_accounts
if unlimited?
@antenna.accounts.without_suspended.includes(:account_stat).all
else
@antenna.accounts.without_suspended.includes(:account_stat).paginate_by_max_id(limit_param(DEFAULT_ACCOUNTS_LIMIT), params[:max_id], params[:since_id])
end
end
def antenna_accounts
Account.find(account_ids)
end