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

22
app/actions/plan.ts Normal file
View File

@@ -0,0 +1,22 @@
"use server"
import prisma from "@/lib/prisma"
import { revalidatePath } from "next/cache"
import { sendNotification } from "@/lib/notifications"
export async function updatePlan(planId: string, data: { instructions?: string; webhookUrl?: string; notifyAll?: boolean }) {
const plan = await prisma.plan.update({
where: { id: planId },
data: {
instructions: data.instructions,
webhookUrl: data.webhookUrl,
notifyAll: data.notifyAll,
}
})
if (data.instructions && plan.webhookUrl && plan.notifyAll) {
await sendNotification(plan.webhookUrl, `📝 UPDATED: Cat instructions have been modified.`)
}
revalidatePath(`/dashboard/${planId}`)
}