import state from "../../store";
export default async function addPin(db, input) {
  var _a;
  const data = {
    ...input,
    createdAt: new Date(),
    order: ((_a = state === null || state === void 0 ? void 0 : state.pins) === null || _a === void 0 ? void 0 : _a.length) || null,
  };
  if (input === null || input === void 0 ? void 0 : input.userId)
    data.user = db.document("users", input === null || input === void 0 ? void 0 : input.userId);
  return db.add("pins", data);
}
//# sourceMappingURL=addPin.js.map