// @ts-check /// // Google 予定の題名・説明・場所・色を返す。入力には連絡先も含まれるが、この例は電話番号・メールを使わない。 // 返した文字列は Google カレンダー(拠点の共有カレンダー)に出る。個人情報を出すかどうかは拠点の判断。 /** * @param {Niho.GcalFormatInput} input * @returns {Niho.GcalFormatOutput} */ export default function formatGcalEvent(input) { const { booking, applicant, member } = input; const name = applicant?.fullName ?? member?.displayName ?? (booking.creatorName || "ご利用者"); const summary = (booking.isProvisional ? "【仮予約】" : "") + name + "さん " + booking.headCount + "名"; const lines = [ "場所:" + booking.placeLabel, "利用者:" + name + "さん", "人数:" + booking.headCount + "名", "日時:" + booking.start.date + "(" + booking.start.weekday + ") " + booking.start.time + "〜" + booking.end.time, ]; if (booking.memo) lines.push("メモ:" + booking.memo); /** @type {Niho.GcalFormatOutput} */ const output = { summary, description: lines.join("\n"), location: booking.placeLabel }; // 仮予約は色を付ける(colorId は "1"〜"11"。省略すると標準の色)。 if (booking.isProvisional) output.colorId = "5"; return output; }