about summary refs log tree commit diff
path: root/app/controllers/api/v1/accounts/lists_controller.rb
blob: ccb751f8f7dc64601e6cf3a23427be6ae24a9b70 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# 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

  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