class Ecs::UsersController < Ecs::BaseController
  skip_before_action :check_user_permission!
  before_action :check_manager_permission!

  def index
    users = UserQuery.call(params)

    @count = users.count
    @users = paginate users.includes(user_extension: [:school, :department])
    @manager_ids = current_major_school.ec_major_school_users.pluck(:user_id)
  end

  private

  def current_major_school
    @_ec_major_school ||= EcMajorSchool.find(params[:ec_major_school_id])
  end

  def current_school
    @_current_school ||= current_major_school.school
  end
end
