feat: Populate gCal calendar cache via webhooks (#11928)
* WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * WIP * Update CalendarService.ts * Type fixes * WIP * fix: improve cache hits * Update CalendarService.ts * Update CalendarService.ts * Update CalendarService.ts * Update CalendarService.ts * Update CalendarService.ts * Update CalendarService.ts * Feedback * Update CalendarService.ts * Update CalendarService.ts * Update _router.ts * feedback * WIP * WIP * Update schema.prisma * feedback * typefixes * Update Calendar.d.ts * fix: watches when adding a calendar * Discard changes to packages/app-store/googlecalendar/api/add.ts * WIP Signed-off-by: Omar López <[email protected]> * WIP Signed-off-by: Omar López <[email protected]> * WP Signed-off-by: Omar López <[email protected]> * Update calendar.ts * Update calendar.ts * Update callback.ts * Update callback.ts * Conflicts * WIP * WIP * Update CalendarService.ts * Cleanup * Discard changes to packages/features/settings/layouts/SettingsLayout.tsx * Update calendar-cache.repository.ts * WIP * Update getSelectedCalendarsToWatch.sql * WIP * Update CalendarService.ts * Cleanup * Discard changes to packages/app-store/googlecalendar/lib/CalendarService.ts * Create CalendarService.wip.ts * WIP * Update CalendarService.ts * Update getSelectedCalendarsToWatch.sql * Delete CalendarService.wip.ts * test updates * cleanup Signed-off-by: Omar López <[email protected]> * Update CalendarService.test.ts * Update CalendarService.ts * type fixes * Update OAuthManager.ts * Update CalendarService.ts * Almost there * Update CalendarService.test.ts * Update calendar.ts * Update callback.ts * Update toggleFeatureFlag.handler.ts * fix: feedback * Update getSelectedCalendarsToWatch.sql * Fix unit tests --------- Signed-off-by: Omar López <[email protected]> Co-authored-by: Udit Takkar <[email protected]>
This commit is contained in:
1 parent
5012a16794
commit
d294a74aad
40 files changed
+963
-240
No files matched your search
@@ -0,0 +1,24 @@
|
||||
SELECT
|
||||
TO_TIMESTAMP(sc."googleChannelExpiration"::bigint / 1000 - 86400)::date as "humanReadableExpireDate",
|
||||
sc.*
|
||||
FROM
|
||||
"SelectedCalendar" sc
|
||||
LEFT JOIN "users" AS u ON u.id = sc. "userId"
|
||||
LEFT JOIN "Membership" AS m ON m. "userId" = u.id
|
||||
LEFT JOIN "Team" AS t ON t.id = m."teamId"
|
||||
LEFT JOIN "TeamFeatures" AS tf ON tf. "teamId" = t.id
|
||||
WHERE
|
||||
-- Only get calendars for teams where cache is enabled
|
||||
tf."featureId" = 'calendar-cache'
|
||||
-- We currently only support google watchers
|
||||
AND sc."integration" = 'google_calendar'
|
||||
AND (
|
||||
-- Either is a calendar pending to be watched
|
||||
sc."googleChannelExpiration" IS NULL
|
||||
OR (
|
||||
-- Or is a calendar that is about to expire
|
||||
sc."googleChannelExpiration" IS NOT NULL
|
||||
-- We substract one day in senconds to renew a day before expiration
|
||||
AND TO_TIMESTAMP(sc."googleChannelExpiration"::bigint / 1000 - 86400)::date < CURRENT_TIMESTAMP
|
||||
)
|
||||
);
|
||||
Reference in new issue
Block a user