From 637693dda12c47113dc2f9b99f54d0146712bd52 Mon Sep 17 00:00:00 2001 From: Tanmai Gopal Date: Wed, 23 Oct 2024 03:59:02 -0700 Subject: [PATCH] The entire calendar app works end to end! --- src/duckduckapi.ts | 10 ++++++++++ src/functions.ts | 14 +++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/duckduckapi.ts b/src/duckduckapi.ts index 76933ec..78aa269 100644 --- a/src/duckduckapi.ts +++ b/src/duckduckapi.ts @@ -12,6 +12,7 @@ import { Connector, Forbidden, } from "@hasura/ndc-sdk-typescript"; +import { JSONValue } from '@hasura/ndc-lambda-sdk'; import path from "node:path" import { FunctionsSchema, getNdcSchema, printRelaxedTypesWarning } from "./lambda-sdk/schema"; @@ -276,4 +277,13 @@ export async function makeConnector(dda: duckduckapi): Promise { - console.log(JSON.stringify(headers.value)); + const oauthServices = headers.value as any; + const {access_token} = getTokensFromHeader(headers, 'google-calendar'); + + if (!access_token) { + console.log(headers.value); + loaderStatus = 'google-calendar key not found in oauth services. Login to google-calendar?'; + return loaderStatus; + } const syncManager = new CalendarSyncManager( - headers.value['google-calendar'].token, - 1 // sync every 5 minutes + access_token, + 1 // sync every minute ); const result = await syncManager.test();