about summary refs log tree commit diff
path: root/app/controllers/api/v1/accounts/lists_controller.rb
blob: 72392453c4e35b3f496b05c98a01eb5352220fc5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

class Api::V1::Accounts::ListsController < Api::BaseController
  before_action -> { doorkeeper_authorize! :read, :'read:lists' }
  before_action :require_user!
  before_action :set_account

  respond_to :json

  def index
    @lists = @account.lists.where(account: current_account)
    render json: @lists, each_serializer: REST::ListSerializer
  end

  private

  def set_account
    @account = Account.find(params[:account_id])
  end
end