From 0bbd49dd80890c06d3a37a847ab000aa643a2e38 Mon Sep 17 00:00:00 2001 From: bigint <69431456+bigint@users.noreply.github.com> Date: Sat, 24 Feb 2024 13:03:36 +0530 Subject: [PATCH] feat: test notion insert events --- apps/api/src/routes/leafwatch/events.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apps/api/src/routes/leafwatch/events.ts b/apps/api/src/routes/leafwatch/events.ts index 4823c84d47a5..5fcbe213e764 100644 --- a/apps/api/src/routes/leafwatch/events.ts +++ b/apps/api/src/routes/leafwatch/events.ts @@ -6,9 +6,12 @@ import requestIp from 'request-ip'; import catchedError from 'src/lib/catchedError'; import createClickhouseClient from 'src/lib/createClickhouseClient'; import checkEventExistence from 'src/lib/leafwatch/checkEventExistence'; +import { notionText, notionTitle } from 'src/lib/notion/notionBlocks'; +import pushToNotionDatabase from 'src/lib/notion/pushToNotionDatabase'; import { invalidBody, noBody } from 'src/lib/responses'; import UAParser from 'ua-parser-js'; import urlcat from 'urlcat'; +import { v4 as uuid } from 'uuid'; import { any, object, string } from 'zod'; type ExtensionRequest = { @@ -110,6 +113,13 @@ export const post: Handler = async (req, res) => { } ] }); + + pushToNotionDatabase('68a15fd7751a408fb6e6ceedc715639a', { + Actor: notionText(actor || 'N/A'), + Event: notionText(name), + ID: notionTitle(uuid()) + }); + logger.info('Ingested event to Leafwatch'); return res.status(200).json({ id: result.query_id, success: true });