The benefit of the previous method of getting cases was that it used `iter_docs` which loads the cases in batches as opposed to loading them all in one go (which can cause memory issues).

I'm still of the opinion that you should modify `get_case_ids_in_domain` to take an optional case type parameter. You can use the same view you are using here (`hqcase/types_by_domain`).