class ReeDaoAggTest::UsersSyncFetcher

def call(ids_or_scope, include: [])

def call(ids_or_scope, include: [])
  scope = if ids_or_scope.is_a?(Array)
    return [] if ids_or_scope.empty?
    users.where(id: ids_or_scope)
  else
    ids_or_scope
  end
  list = scope.all
  return [] if list.empty?
  if include.include?(:organization)
    one_to_one(list, organizations_dao.order(:id))
  end
  if include.include?(:books)
    one_to_many(list, books.order(:id))
  end
  if include.include?(:movies)
    one_to_many(list, movies.order(:id))
  end
  if include.include?(:videogames)
    one_to_many(list, videogames.order(:id))
  end
  if include.include?(:hobbies)
    one_to_many(list, hobbies.order(:id), assoc_setter: :set_hobbies)
  end
  if include.include?(:skills)
    one_to_many(list, skills.order(:id))
  end
  if include.include?(:vinyls)
    one_to_many(list, vinyls.order(:id))
  end
  if include.include?(:pets)
    one_to_many(list, pets.order(:id))
  end
  if include.include?(:dreams)
    one_to_many(list, dreams.order(:id))
  end
  if include.include?(:passport)
    one_to_one(list, user_passports.order(:id), reverse: true, assoc_setter: :set_passport)
  end
  if ids_or_scope.is_a?(Array)
    list.sort_by { ids_or_scope.index(_1.id) }
  else
    list
  end
end