export default async function listDots(db, { siteId, jobId, limit, orderBy, orderDirection, next }) {
  const where = [];
  if (siteId)
    where.push({
      key: "site",
      conditional: "==",
      value: db.document("sites", siteId),
    });
  if (jobId)
    where.push({
      key: "job",
      conditional: "==",
      value: db.document("jobs", jobId),
    });
  return db.list("dots", where, `${orderBy || "name"}${orderDirection ? `:${orderDirection}` : ""}`, limit, {
    startAfter: next,
  });
}
