From fd2ee317141a2fdd52139f61772b06610f639651 Mon Sep 17 00:00:00 2001 From: Pihkaal Date: Sun, 21 Dec 2025 14:27:49 +0100 Subject: [PATCH] feat: log action type --- src/index.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 9798429..d3ef563 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,12 +1,25 @@ import express from "express"; +import { z } from "zod"; import { env } from "./env"; +const webhookSchema = z.object({ + action: z.enum(["deleted", "created"]), +}); + const app = express(); app.use(express.json()); -app.post("/", (req, res) => { - console.log(req); +app.post("/", async (req, res) => { + const result = webhookSchema.safeParse(req.body); + if (!result.success) { + res.sendStatus(200); + return; + } + + const { action } = result.data; + console.log(`Webhook received: ${action}`); + res.sendStatus(200); });