Skip to content

Commit 8d1c169

Browse files
committed
chore: format recurring-events guide
1 parent cc97ad5 commit 8d1c169

1 file changed

Lines changed: 21 additions & 21 deletions

File tree

docs/learn/recurring-events.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
# Recurring Events
1+
# Recurring Events
22

33
## Core Concepts
44

55
### What is a Recurring Event?
66

77
A recurring event in Google Calendar consists of:
88

9-
- A **base event** that defines the pattern (e.g., "Weekly Meeting every Monday at 2pm")
10-
- **instances** that follow that pattern (e.g., individual meetings on specific Mondays)
9+
- **Base event** that defines the pattern (e.g., "Weekly Meeting every Monday at 2pm")
10+
- Base event: has `recurrence.eventId` AND `recurrence.rule` (e.g., "RRULE:FREQ=WEEKLY")
11+
- `recurrence.eventId` === `gEventId`
12+
- **Instances**: Individual occurrences that follow that pattern (e.g., individual meetings on specific Mondays)
13+
- Instance: has `recurrence.eventId` AND NOT `recurrence.rule`
14+
- **Recurrence Rule**: Defines how the event repeats (frequency, interval, exceptions)
15+
- **Original Start Time**: The time an instance was originally scheduled for (important when instances are modified)
1116

1217
Think of it like a template (base event) that generates individual events (instances) based on a rule.
1318

14-
### Key Properties
1519

16-
- **Base Event**: Contains the recurrence rule (e.g., "RRULE:FREQ=WEEKLY")
17-
- **Instances**: Individual occurrences that follow the pattern
18-
- **Recurrence Rule**: Defines how the event repeats (frequency, interval, exceptions)
19-
- **Original Start Time**: The time an instance was originally scheduled for (important when instances are modified)
2020

2121
## Event Relationships and Workflow
2222

@@ -27,7 +27,7 @@ graph TD
2727
Base -->|has| Rule[Recurrence Rule]
2828
Instances -->|link to| Base
2929
Instances -->|have| OriginalTime[Original Start Time]
30-
30+
3131
BaseEvent[Base Event<br>ID: 123]
3232
InstanceEvent[Instance Event<br>ID: 123_20250323T120000Z]
3333
ModifiedBase[Modified Base<br>ID: 123_R20250323T120000Z]
@@ -94,7 +94,7 @@ graph LR
9494
Base -->|generates| Normal[Normal Instance]
9595
Base -->|generates| Modified[Modified Instance]
9696
Base -->|generates| Cancelled[Cancelled Instance]
97-
97+
9898
Modified -->|has| OriginalTime[Original Start Time]
9999
Modified -->|links to| Base
100100
Normal -->|links to| Base
@@ -310,14 +310,14 @@ When changes occur in Google Calendar:
310310

311311
When you receive events from Google Calendar, they follow these patterns:
312312

313-
| Change Type | Payload Contents | Key Indicators |
314-
| ------------------ | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ |
315-
| New Recurring | Single base event with `recurrence` rule | - Only contains the base\n- Has `recurrence` rule\n- No instance events |
313+
| Change Type | Payload Contents | Key Indicators |
314+
| ------------------ | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
315+
| New Recurring | Single base event with `recurrence` rule | - Only contains the base\n- Has `recurrence` rule\n- No instance events |
316316
| Edit One Instance | Base event + modified instance | - Instance has `_` in ID\n- Has `recurringEventId`\n- No `recurrence` rule\n- Other instances unchanged |
317317
| Edit This & Future | Original base + modified instance + new base | - Original base has `UNTIL` rule\n- Modified instance\n- New base with `_R` suffix\n- New base has new `recurrence` rule |
318-
| Edit All Instances | Modified base + new base | - Base has `UNTIL` rule\n- New base with `_R` suffix\n- All instances updated |
319-
| Delete Instance | Base event + cancelled instance | - Instance marked as "cancelled"\n- Has `recurringEventId`\n- Base event unchanged |
320-
| Delete Series | All instances marked as "cancelled" | - No base event\n- All events marked as "cancelled"\n- All have same `recurringEventId` |
318+
| Edit All Instances | Modified base + new base | - Base has `UNTIL` rule\n- New base with `_R` suffix\n- All instances updated |
319+
| Delete Instance | Base event + cancelled instance | - Instance marked as "cancelled"\n- Has `recurringEventId`\n- Base event unchanged |
320+
| Delete Series | All instances marked as "cancelled" | - No base event\n- All events marked as "cancelled"\n- All have same `recurringEventId` |
321321

322322
### Database Updates
323323

@@ -392,13 +392,13 @@ class CalendarSyncService {
392392
private analyzeChanges(changes: gSchema$Event[]): ActionAnalysis {
393393
// Find base event and instances
394394
const baseEvent = changes.find(
395-
(event) => event.recurrence && !event.recurringEventId,
395+
(event) => event.recurrence && !event.recurringEventId
396396
);
397397
const instances = changes.filter((event) => event.recurringEventId);
398398

399399
// Check for cancelled events
400400
const cancelledEvents = changes.filter(
401-
(event) => event.status === "cancelled",
401+
(event) => event.status === "cancelled"
402402
);
403403

404404
// Determine the type of change
@@ -435,7 +435,7 @@ class CalendarSyncService {
435435
case "DELETE_INSTANCES":
436436
await this.deleteInstances(
437437
analysis.baseEvent?.id,
438-
analysis.modifiedInstance,
438+
analysis.modifiedInstance
439439
);
440440
break;
441441
// ... handle other cases ...
@@ -461,12 +461,12 @@ class CalendarSyncService {
461461

462462
private async deleteInstances(
463463
baseEventId: string,
464-
cancelledInstance: gSchema$Event,
464+
cancelledInstance: gSchema$Event
465465
) {
466466
// Mark instance as cancelled in database
467467
await db.events.updateOne(
468468
{ id: cancelledInstance.id },
469-
{ $set: { status: "cancelled" } },
469+
{ $set: { status: "cancelled" } }
470470
);
471471
}
472472
}

0 commit comments

Comments
 (0)