Skip to content

Commit

Permalink
nocodb why are you like this??
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleylamont committed Sep 17, 2024
1 parent 4fdf60d commit 2f7ee0c
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/nocodb-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
DBGetRowsResponse,
MembershipDBItem,
QuoteDBItem,
NocoDBNestedCreatedWebhook,
} from "./nocodb-types";
import express, { Express, Request } from "express";
import { GuildMember, Snowflake } from "discord.js";
Expand Down Expand Up @@ -115,19 +114,16 @@ export async function attachNocoDBWebhookListener(expressApp: Express) {

expressApp.post(
"/quote",
async (
request: Request<NocoDBNestedCreatedWebhook<QuoteDBItem>>,
response,
) => {
async (request: Request<NocoDBWebhook<QuoteDBItem>>, response) => {
if (request.headers["x-cssa-secret"] != process.env.WEBSOCKET_SECRET) {
console.warn("Illegal websocket update.");
response.status(401).send();
return;
}
console.log("Received db webhook.");
const webhookBody: NocoDBNestedCreatedWebhook<QuoteDBItem> = request.body;
const webhookBody: NocoDBWebhook<QuoteDBItem> = request.body;

const row = webhookBody.data.rows[0]?.rows?.[0];
const row = webhookBody.data.rows[0];
if (!row) {
console.error("No quote data in webhook.");
response.status(204).send();
Expand Down

0 comments on commit 2f7ee0c

Please sign in to comment.