feat: log action type
All checks were successful
Build and Push Docker Image / build (push) Successful in 42s

This commit is contained in:
Pihkaal
2025-12-21 14:27:49 +01:00
parent 19b9f62c46
commit fd2ee31714

View File

@@ -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);
});