Skip to content

Commit 7943dcd

Browse files
committed
fix(calendar): use alex@codingcat.dev exclusively for bookings and remove personal email from attendees
1 parent 34c47e0 commit 7943dcd

3 files changed

Lines changed: 22 additions & 26 deletions

File tree

‎apps/site/src/lib/google-calendar.ts‎

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,7 @@ import { getSanityServerClient } from "@/lib/sanity/write-client";
33

44
export const STREAMYARD_STUDIO_URL = "https://streamyard.com/c4kv26is93";
55

6-
export const CODINGCAT_CALENDAR_IDS = [
7-
"alex.patterson@gmail.com",
8-
"alex@codingcat.dev",
9-
"alex@flipfeeds.com",
10-
"alex.patterson@sanity.io",
11-
"mikqhmn29svd9p9m99quch9nuo@group.calendar.google.com", // Oliver - Alex
12-
"2em0afukjm0gk9k3n0ohh5ag3g@group.calendar.google.com", // Oliver - Events
13-
"a1jir6k8sl9k38fbbohoei5f80@group.calendar.google.com", // Oliver - Heidi
14-
];
6+
export const CODINGCAT_CALENDAR_IDS = ["alex@codingcat.dev"];
157

168
export interface AvailableCalendarSlot {
179
id: string;
@@ -39,8 +31,12 @@ async function getAccessToken(
3931
const clientId = workerEnv.GOOGLE_CLIENT_ID || process.env.GOOGLE_CLIENT_ID;
4032
const clientSecret =
4133
workerEnv.GOOGLE_CLIENT_SECRET || process.env.GOOGLE_CLIENT_SECRET;
34+
// Prefer GOOGLE_WORKSPACE_REFRESH_TOKEN (alex@codingcat.dev) so all bookings and FreeBusy
35+
// checks operate under the CodingCat.dev workspace account and never expose personal emails.
4236
const refreshToken =
4337
refreshTokenOverride ||
38+
workerEnv.GOOGLE_WORKSPACE_REFRESH_TOKEN ||
39+
process.env.GOOGLE_WORKSPACE_REFRESH_TOKEN ||
4440
workerEnv.GOOGLE_REFRESH_TOKEN ||
4541
process.env.GOOGLE_REFRESH_TOKEN;
4642

@@ -457,14 +453,14 @@ export function buildGoogleCalendarTemplateUrl(opts: {
457453
}
458454

459455
/**
460-
* Creates a Google Calendar event on alex@codingcat.dev (and invites alex.patterson@gmail.com):
456+
* Creates a Google Calendar event exclusively on alex@codingcat.dev:
461457
* - 15-minute Pre-Meetings ("pre-meeting-15m" | "sponsor-kickoff"):
462458
* Immediately creates a CONFIRMED, OPAQUE (Busy) event with an auto-generated Google Meet room
463-
* (conferenceDataVersion=1) and sends invites (sendUpdates=all) to the guest and Alex.
464-
* - 45-minute Recording Sessions ("recording-45m"):
465-
* Immediately creates a CONFIRMED, OPAQUE (Busy) calendar placeholder on Alex's calendars
466-
* (sendUpdates=none) so nothing else can jump the slot. Once approved in the Ops App,
467-
* approveGoogleCalendarRecordingEvent() reveals https://streamyard.com/c4kv26is93 and invites the guest.
459+
* (conferenceDataVersion=1) and sends invites (sendUpdates=all) to the guest and alex@codingcat.dev.
460+
* - 60-minute Recording Sessions ("recording-60m"):
461+
* Immediately creates a CONFIRMED, OPAQUE (Busy) calendar hold on alex@codingcat.dev and sends
462+
* the calendar hold invite to the guest (sendUpdates=all) so it lands on their calendar right away,
463+
* while withholding https://streamyard.com/c4kv26is93 until approved in the Ops App.
468464
*/
469465
export async function createGoogleCalendarBookingEvent(opts: {
470466
guestName: string;
@@ -562,13 +558,11 @@ export async function createGoogleCalendarBookingEvent(opts: {
562558
}
563559
}
564560

565-
// Always invite the guest immediately (sendUpdates=all) so the event lands on their
566-
// Google Calendar right away. Unapproved recording holds withhold the StreamYard URL
567-
// until Alex clicks Approve in the Ops App.
561+
// Always invite the guest immediately (sendUpdates=all) on alex@codingcat.dev so the event
562+
// lands on their Google Calendar right away without exposing any personal email address.
568563
const sendUpdates = "all";
569564
const attendees = [
570-
{ email: "alex.patterson@gmail.com", responseStatus: "accepted" },
571-
{ email: "alex@codingcat.dev", responseStatus: "accepted" },
565+
{ email: "alex@codingcat.dev", displayName: "Alex Patterson", responseStatus: "accepted" },
572566
{ email: opts.guestEmail, displayName: opts.guestName },
573567
];
574568

@@ -580,7 +574,7 @@ export async function createGoogleCalendarBookingEvent(opts: {
580574
const eventBody: Record<string, unknown> = {
581575
summary,
582576
description,
583-
// Always "confirmed" + "opaque" so FreeBusy blocks this slot across all calendars!
577+
// Always "confirmed" + "opaque" so FreeBusy blocks this slot on alex@codingcat.dev!
584578
status: "confirmed",
585579
transparency: "opaque",
586580
location: isPreMeeting
@@ -643,7 +637,10 @@ export async function createGoogleCalendarBookingEvent(opts: {
643637
meetUrl,
644638
recordingUrl: STREAMYARD_STUDIO_URL,
645639
addToCalendarUrl,
646-
calendarMode: inviteGuestNow ? "confirmed_invite" : "tentative_hold",
640+
calendarMode:
641+
isPreMeeting || isApprovedRecording
642+
? "confirmed_invite"
643+
: "tentative_hold",
647644
};
648645
} catch {
649646
return {
@@ -704,8 +701,7 @@ export async function approveGoogleCalendarRecordingEvent(opts: {
704701
start: { dateTime: start.toISOString() },
705702
end: { dateTime: end.toISOString() },
706703
attendees: [
707-
{ email: "alex.patterson@gmail.com", responseStatus: "accepted" },
708-
{ email: "alex@codingcat.dev", responseStatus: "accepted" },
704+
{ email: "alex@codingcat.dev", displayName: "Alex Patterson", responseStatus: "accepted" },
709705
{ email: opts.guestEmail, displayName: opts.guestName },
710706
],
711707
};

‎apps/site/src/pages/api/booking.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ export const POST: APIRoute = async ({ request, url }) => {
337337
: "Opaque Busy hold created on Alex's Google Calendar (Approve in Ops App to send StreamYard https://streamyard.com/c4kv26is93)";
338338

339339
await sendCodingCatEmail({
340-
to: "alex.patterson@gmail.com",
340+
to: "alex@codingcat.dev",
341341
subject: `[CodingCat.dev ${subjectLabel}] ${guestName} (${company})`,
342342
text: [
343343
`New CodingCat.dev ${subjectLabel}`,

‎apps/site/src/pages/api/sponsorship.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ export const POST: APIRoute = async ({ request, url }) => {
251251

252252
// 4. Fire-and-forget notification email via Cloudflare Email Routing if bound
253253
await sendCodingCatEmail({
254-
to: "alex.patterson@gmail.com",
254+
to: "alex@codingcat.dev",
255255
subject: `[CodingCat.dev Sponsor Inquiry] ${company} (${selectedTier.name} - $${selectedTier.priceUsd})`,
256256
text: [
257257
"New Sponsorship Inquiry on CodingCat.dev",

0 commit comments

Comments
 (0)