chore: initialized repository

This commit is contained in:
Lukas Wölfer
2026-04-16 22:00:50 +02:00
parent 0a74a9a7ef
commit 74c94b05f9
12 changed files with 354 additions and 53 deletions

View File

@@ -21,6 +21,24 @@ const client = postgres(process.env.DATABASE_URL);
const db = drizzle(client, { schema });
app.use((_, __, next) => DatabaseContext.run(db, next));
// API endpoint to record castration
app.post("/api/castration", express.json(), async (req, res) => {
try {
const { gender } = req.body;
if (!gender || !["male", "female"].includes(gender)) {
return res.status(400).json({ error: "Invalid gender" });
}
const result = await db.insert(schema.castrations).values({ gender });
return res.json({ success: true, result });
} catch (error) {
console.error("Error recording castration:", error);
return res.status(500).json({ error: "Failed to record castration" });
}
});
app.use(
createRequestHandler({
build: () => import("virtual:react-router/server-build"),