Initial commit: Cat Sitting Planner with PWA, SQLite, and Webhook Notifications

This commit is contained in:
2026-01-12 20:48:23 +01:00
commit 3121ef223d
52 changed files with 13722 additions and 0 deletions

27
app/api/plan/route.ts Normal file
View File

@@ -0,0 +1,27 @@
import { NextResponse } from 'next/server';
import prisma from '@/lib/prisma';
export async function POST(req: Request) {
try {
const body = await req.json();
const { startDate, endDate, password, instructions } = body;
if (!startDate || !endDate || !password) {
return NextResponse.json({ error: 'Missing required fields' }, { status: 400 });
}
const plan = await prisma.plan.create({
data: {
startDate: new Date(startDate),
endDate: new Date(endDate),
password,
instructions,
},
});
return NextResponse.json({ planId: plan.id });
} catch (error) {
console.error('Error creating plan:', error);
return NextResponse.json({ error: 'Internal Server Error' }, { status: 500 });
}
}