Apps Script로 캘린더 예약을 만들 때 쓰는 건 결국 API 두 개다.

Calendar.Freebusy.query로 바쁜 일정을 받아 근무 요일·근무 시간과 겹치는 슬롯을 빼면 예약 가능한 슬롯이 남는다. 예약은 CalendarApp.getCalendarById로 이벤트를 만들고 sendInvites: true로 초대 메일까지 보낸다1.

Freebusy는 슬롯을 계산할 때와 실제로 예약할 때 두 번 조회한다 — 그 사이에 일정이 생길 수 있으니.2


Footnotes

  1. Class Calendar · createEvent(title, startTime, endTime, options) | Apps Script: “Whether to send invitation emails (default: false).” — 기본값이 꺼져 있다 ↩

  2. someday backend/src/app.ts — 슬롯 계산(fetchAvailability, L51)과 별도로 bookTimeslot 이 같은 구간을 다시 조회해 busy 가 있으면 Timeslot not available 을 던진다 ↩

#329

Google Spreadsheet 팝업 — onOpen 은 파일을 열 때 도는 예약 이름(단순 트리거)이라 메뉴를 거기서 붙인다.1

function showAlert() {
  const ui = SpreadsheetApp.getUi()
  ui.alert('팝업 창', '표시할 텍스트', ui.ButtonSet.OK)
}

// 메뉴에 추가
function onOpen() {
  SpreadsheetApp.getUi()
    .createMenu('팝업 메뉴')
    .addItem('팝업 띄우기', 'showAlert')
    .addToUi()
}

Footnotes

  1. Simple Triggers - Apps Script: “onOpen(e) runs when a user opens a spreadsheet, document, presentation, or form that the user has permission to edit.” / Class Ui: “Opens a dialog box in the user’s editor with the given title, message, and set of buttons.” ↩

#337