lists_controller.rb 478 B

123456789101112131415161718
  1. # frozen_string_literal: true
  2. class Api::V1::Accounts::ListsController < Api::BaseController
  3. before_action -> { doorkeeper_authorize! :read, :'read:lists' }
  4. before_action :require_user!
  5. before_action :set_account
  6. def index
  7. @lists = @account.suspended? ? [] : @account.lists.where(account: current_account)
  8. render json: @lists, each_serializer: REST::ListSerializer
  9. end
  10. private
  11. def set_account
  12. @account = Account.find(params[:account_id])
  13. end
  14. end