export default async function addAlert(db, data) {
  const docData = { ...data, createdAt: new Date() };
  if (data === null || data === void 0 ? void 0 : data.templateId)
    docData.template = db.document("templates", data.templateId);
  const addDoc = await db.add("alerts", docData);
  docData.id = addDoc.id;
  return docData;
}
