Skip to content

Commit

Permalink
Ignore transparent events in source calendar.
Browse files Browse the repository at this point in the history
  • Loading branch information
sleiss committed Apr 16, 2022
1 parent cb2b8b3 commit 9d7f5da
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
7 changes: 5 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ const syncCalendar = async (): Promise<{
timeMin: earliestDate.toISOString(),
timeMax: latestDate.toISOString(),
});
const sourceEvents = sourceEventsResponse.data.items || [];
let sourceEvents: calendar_v3.Schema$Event[] = sourceEventsResponse.data.items || [];

// Do not include events with transparency === transparent as they do not block the time
sourceEvents = sourceEvents.filter(t => !(t.transparency && t.transparency === 'transparent'));

const targetEventsResponse = await calendar.events.list({
auth,
Expand Down Expand Up @@ -134,7 +137,7 @@ const updateEvent = async (sourceEvent: calendar_v3.Schema$Event, sourceEventId:
});
}

const getRequestBody = (sourceEvent: calendar_v3.Schema$Event, sourceEventId: string, configEntry: SourceTargetConfiguration) => {
const getRequestBody = (sourceEvent: calendar_v3.Schema$Event, sourceEventId: string, configEntry: SourceTargetConfiguration): calendar_v3.Schema$Event => {
return {
summary: 'Private event',
description: `This is a private event synced by google-calendar-sync.
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cirqusde/google-calendar-sync",
"version": "1.0.0",
"version": "1.0.1",
"repository": "https://github.com/cirqusde/google-calendar-sync",
"description": "Sync events from your private Google Calendar to your work Google calendar.",
"author": "Simon Leiß",
Expand Down

0 comments on commit 9d7f5da

Please sign in to comment.