From 5a9f0c0e6f8790c0719782876ebc9faf0f6295c7 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 19 Sep 2023 16:58:51 -0500 Subject: [PATCH] add ts --- packages/twitch/events/src/index.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/twitch/events/src/index.ts b/packages/twitch/events/src/index.ts index ce695a1c..8d2d1498 100644 --- a/packages/twitch/events/src/index.ts +++ b/packages/twitch/events/src/index.ts @@ -5,6 +5,7 @@ import express from 'express' import { Server as SocketServer } from 'socket.io' import { io } from 'socket.io-client' +import { Tables } from './db/supabase-types.js' import { handleNewUser } from './handleNewUser.js' import { SubscribeEvents } from './SubscribeEvents.js' import BotAPI from './twitch/lib/BotApiSingleton.js' @@ -127,7 +128,7 @@ webhookApp.post('/', express.json(), express.urlencoded({ extended: true }), (re if (req.body.type === 'INSERT' && req.body.table === 'accounts') { const { body } = req - const user = body.record + const user = body.record as InsertPayload>['record'] if (IS_DEV && !DEV_CHANNELIDS.includes(user.providerAccountId)) return if (!IS_DEV && DEV_CHANNELIDS.includes(user.providerAccountId)) return @@ -145,8 +146,8 @@ webhookApp.post('/', express.json(), express.urlencoded({ extended: true }), (re }) } else if (req.body.type === 'UPDATE' && req.body.table === 'users') { const { body } = req - const oldUser = body.old_record - const newUser = body.record + const oldUser = body.old_record as UpdatePayload>['old_record'] + const newUser = body.record as UpdatePayload>['record'] if (IS_DEV && !DEV_CHANNELS.includes(newUser.name)) return if (!IS_DEV && DEV_CHANNELS.includes(newUser.name)) return